andli / pymkm

Python wrapper for the cardmarket.com API. Also contains a working app with price updating of your personal stock, csv import etc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CSV Import

caliendojulien opened this issue · comments

I got an error when importing card from list.csv

Action number: 7
Note the required format: Card, Set name, Quantity, Foil, Language (with header row).
Cards are added in condition NM.
N/A% (0 of 10) | | Elapsed Time: 0:00:00 ETA: --:--:--Traceback (most recent call last):
File "main.py", line 545, in
main()
File "main.py", line 89, in main
import_from_csv(api=api)

File "main.py", line 133, in import_from_csv
product_match[0]['idProduct'], foil, langauge_id, api)
File "C:\Users\CJ\Downloads\pymkm-master\pymkm.py", line 29, in call
return_value = self.function(*arg, **kwargs)
File "main.py", line 393, in _get_price_for_product
r = api.get_product(product_id)
AttributeError: 'int' object has no attribute 'get_product'

list.csv is :
Card,Set Name,Quantity,Foil,Language
brain pry,Dissension,1,,French
court hussar,Dissension,3,,French
flaring flame-kin,Dissension,1,,French
mistral charger,Dissension,1,,French
prahv, spires of order,Dissension,2,,French
sky hussar,Dissension,2,,French
slithering shade,Dissension,1,,French
stoic ephemera,Dissension,1,,French
transguild courier,Dissension,1,,French

Thanks for submitting this, it's probably an easy fix - I'll look into it when I get back from vacation on Monday. Did you remove the first column header row from the csv file?

I got the exact same error with the original file list.csv.

Hope you can fix it. It's, by far, the best tools for MKM i ever seen.

on main.py line 462

def __get_foil_price(api, product_id, language_id):
account = api.get_account()['account']

api is an int. 'int' object has no attribute 'get_account'"

No worries, I'll fix it easily when I have a computer again... Right now I am on a beach on Mallorca. 😉
Thanks for the kind words.

I'm not a very good developer but i try to understand :)
if i change

def __get_foil_price(api, product_id, language_id):

to

def __get_foil_price(language_id, product_id, api):

it's seem to work. Hope it can help.

Issue can be closed.
I just uncomment

api.add_stock([card])

line 142 in main.py

and it works.

Thanks, I have pushed a commit fixing the error you found!