Traceback (most recent call last):
File "c:\program files\python37\lib\site-packages\wx\core.py", line 2228, in Notify
self.notify()
File "c:\program files\python37\lib\site-packages\wx\core.py", line 3384, in Notify
self.result = self.callable(*self.args, **self.kwargs)
File "c:\program files\python37\lib\site-packages\kicost\kicost_gui.py", line 770, in run
dist_list.append(v['module'])
KeyError: 'module'
Fix, replace your file by that available at https://github.com/xesscorp/KiCost/ . I will release it soon on PYPI.
The GUI (graphical user interface) still need some improvement but I am the only active programmer now. We still need some testers users and help with the GUI.
Tip: use kicost --setup (and the opposite kicost --unsetup) to add it to the Eeschema BOM list.
Which file I have to replace?
This issue just committed the kicost_gui.py file.
But to be sure you can replace your installation for the full folder kicost that you can download here https://github.com/xesscorp/KiCost/
Search in your Windows for the kicost folder and replace it.
What’s PYPI ?
It is the official release in here https://pypi.org/project/kicost/
When I officially release a version user can simple install by pip install kicost in the terminal.
kicost --setup will add manf# field to EESchema default fields-set? --setup adds KiCost to the BOM list on Eeschema, beeing now access directly in KiCad without terminal or external commands.
Interesting: add “manf#” as default field when I run --setup.
If you have more ideas that can help / make easy to use, please submit in https://github.com/xesscorp/KiCost/issues
I will share any idea I’ll have don’t worry.
And if I can be of any help please ask I’m always available. Please take into account that I’m just starting to learn Python (I wish to create some simple plugins for Kicad) but I’m pretty good in C, C++, Java. and in english->italian localization.
Yes pip install -U kicost but just after I officially release 1.1.2 version (I will do just after some tests and add the “manf#” as default).
If you are familiar with git (and have it installed), you can run pip install -U git+https://github.com/xesscorp/KiCost/
to get the last coded version. If you haven’t git installed, the replace file make the same procedure.
luckly I already have git installed and I’m familiar with it.
BTW In the past I requested an OCTOPART key (free one) and I obtained it … how can I setup KiCost to use it?
After the successful update I tried to run it again but, using the --gui option it hangs without any error/warning.
If I run it trough console without the --gui switch I got this:
kicost -i V2-10A122_ki.xml -o V2-10A122.xlsx
Traceback (most recent call last):
File "C:\Program Files\Python37\Scripts\kicost-script.py", line 11, in <module>
load_entry_point('kicost==1.1.1', 'console_scripts', 'kicost')()
File "c:\program files\python37\lib\site-packages\kicost\__main__.py", line 319, in main
dist_list=dist_list, currency=args.currency)
File "c:\program files\python37\lib\site-packages\kicost\kicost.py", line 164, in kicost
p, info = eda_module.get_part_groups(in_file[i_prj], ignore_fields, variant[i_prj])
File "c:\program files\python37\lib\site-packages\kicost\edas\eda_kicad.py", line 154, in get_part_groups
for c in root.find('components').find_all('comp'):
AttributeError: 'NoneType' object has no attribute 'find_all'
I kept the distributors/api_octopart.py updated on the installation. But you will have to made some manual changes:
Add your KEY manually inside the api_octopart.py file through the definition def query(query, apiKey=None). Change the None to "YOUR_TOKEN";
At kicost.py file change api_partinfo_kitspace.query_part_info(parts, distributor_dict, currency) to api_ocotpart.query_part_info(parts, distributor_dict, currency).
Those change should be enough. I have plan to made this easy for users to change though configuration in the Windows/GUI. But I need some programmer to help me (with the GUI), for now I am just using the time to keep KiCost running and updating the motor (internal functions).
Following you suggestion to share ideas: why don’t you put an command line option like --octopartkey KEY to insert it inline or --keyfile FILENAME to specify a file where the key string is stored? I think it should be pretty easy to implement and avoid people like me to go editing Python files (in my opinion this could lead to some unpredictable behaviours)…
In GUI you should just put a textbox where to insert the key string.
The problem if that is: every time that I change or add a new module I will have to create --octopartkey/ --digikeykey… creating more work for me to maintenance.
The GUI already have the function to save the filled fields. I just need (help) create a table that using the modules at distributors folder show columns with the configurations.
The low level work is almost done, missing all the GUI part integration.
Also the file already used for this could be used in the CLI access.
I really haven’t got what you mean there, besides the key features that’s not so important (I’m using kicost as is without inserting my octopart key at this moment and it looks to works fine).
The GUI already have the function to save the filled fields. I just need (help) create a table that using the modules at distributors folder show columns with the configurations.
If you explain a little more maybe I can help you with this but up to now I really haven’t got what you was meaning.
The low level work is almost done, missing all the GUI part integration. Also the file already used for this could be used in the CLI access.
For what? They are referred to the previous statement?
The most important is that the GUI freeze when the “KiCost motor” is working. This is due the logger library used to print at terminal (when running KiCost just by terminal).
I redirect the messages output to the text box (using the GUI_LoggerHandler class at the kicost_gui.py file) by appear that this specific issue is related to the wx.CallLater(10, self.run) directive in wxPython (the graphical library used).
The expected behavior is: not freeze the GUI, print message-by-message in the text box and load the process bar.
What I want to mean with the save GUI fields routine is: doing that (in the actual code) will be allow add many distributors modules / API as we want (not just kitspace and octopart by direct access to digikey, mouser …). The GUI (or the direct modification of the file that saves the GUI information) will allow the user to define the KEYS and what module to use.
Important to remember is that Octopart have price information about more distributors than Kitspace. And Kitspace is a OpenCollective initiative https://opencollective.com/kitspace
Check that the dialog window is frozen (you can try click again in “KiCost it!” but it will not get pressed)
Wait one or two minutes;
The spreadsheet will automatically open in your default software.
The GUI (Graphical User Interface) have a bug: after click in “KiCost it!” the process bar should start to fill, showing the progress. Now the progress bar just get full at the end, not showing the intermediary process.
I still need some help (by Python programmers) to fix this issue.