Closed joaoantoniocardoso closed 4 years ago
What do you mean "fails" - have you found that KiBom does not run with Python3?
Hah, funny... Almost every python2 script I know doesn't run with python3, if that wasn't a joke...
I mean that explicit calling python2 could prevent some linuxes of trying to wrongly execute using python3 instead.
What is the specific error you get, though (wasn't a joke! :) )
It might indeed be easier just to specify python2 but if there's something python3 related we can address...
@SchrodingersGat sorry for long delay... I got the following if not explicit telling that is python2:
Command error. Return code 1 Error messages: Traceback (most recent call last): File "/home/joaoantoniocardoso/KiBoM/KiBOM_CLI.py", line 108, in
pref.Write(config_file) File "/home/joaoantoniocardoso/KiBoM/KiBOM/preferences.py", line 212, in Write cf.write(configfile) File "/usr/lib/python3.6/configparser.py", line 919, in write self._sections[section].items(), d) File "/usr/lib/python3.6/configparser.py", line 923, in _write_section fp.write("[{}]\n".format(section_name)) TypeError: a bytes-like object is required, not 'str'
@joaoantoniocardoso I believe this should now be fixed with recent PR providing Py2/Py3 support. Can you please check? I'm closing the PR but please re-open if the issue is not resolved for you.
Hi @SchrodingersGat ,
I was working with the old version with the submitted patch. Now I did a pull updating the local repository and than when I clicked "generate" on KiCAD it fails (in a different way) and my patch do not fix it anymore.
Here is the results:
Run command:
python2 "/home/joaoantoniocardoso/KiBoM/KiBOM_CLI.py" "/home/joaoantoniocardoso/Dropbox/IFSC/Documentos/2019-1/SCT2/sct2_projeto1/hardware/main/main.xml" "/home/joaoantoniocardoso/Dropbox/IFSC/Documentos/2019-1/SCT2/sct2_projeto1/hardware/main/main"
Command error. Return code 1
Info messages:
PCB variant: default
Error messages:
Traceback (most recent call last):
File "/home/joaoantoniocardoso/KiBoM/KiBOM_CLI.py", line 202, in <module>
result = writeVariant(variant, args)
File "/home/joaoantoniocardoso/KiBoM/KiBOM_CLI.py", line 76, in writeVariant
pref.Write(config_file)
File "/home/joaoantoniocardoso/KiBoM/bomlib/preferences.py", line 206, in Write
self.addOption(cf, self.OPT_INCLUDE_VERSION, self.includeVersionNumber, comment="If '{opt}' option is set to 1, the schematic version number will be appended to the filename.")
AttributeError: 'BomPref' object has no attribute 'OPT_INCLUDE_VERSION'
Running the old version with the patch-1 (commit 53afc9bc780bc0d65da83dcf5e738064f4e5c574):
Run command:
python2 "/home/joaoantoniocardoso/KiBoM-patch-1/KiBOM_CLI.py" "/home/joaoantoniocardoso/Dropbox/IFSC/Documentos/2019-1/SCT2/sct2_projeto1/hardware/main/main.xml" "/home/joaoantoniocardoso/Dropbox/IFSC/Documentos/2019-1/SCT2/sct2_projeto1/hardware/main/main"
Success
Info messages:
CSV Output -> /home/joaoantoniocardoso/Dropbox/IFSC/Documentos/2019-1/SCT2/sct2_projeto1/hardware/main/main_bom_.csv
Ok. got it. After the bom.ini
(a blank file) was generated with the older version, the newer can generate. So technically yes, the problem with python2 and python3 was solved and now this is about some another issue that the workaround could be simply a touch bom.ini
while we don't fix it in a good manner.
Arch Linux tries to execute this file as python 3 if other version is not specified, and then fails when user presses "Generate" button.