sexpr.py is not added to path for kicad_sym.py [Add requirements.txt]
Issue
I am not able to run any of the new kicad_sym
scripts:
$ python schlib/check_kicad_sym.py Connector.kicad_sym
could not parse library: Connector.kicad_sym
And indeed, running kicad_sym.py
returned the error:
$ python schlib/kicad_sym.py Connector.kicad_sym
Traceback (most recent call last):
File "schlib/kicad_sym.py", line 11, in <module>
import sexpr
ModuleNotFoundError: No module named 'sexpr'
After installing a python virtual environment, I ran:
(env) $ pip install sexpr
... Successfully installed pyyaml-3.12 sexpr-0.2.0 yamlloader-0.5.2
then a new error popped-up:
(env) $ python schlib/kicad_sym.py Connector.kicad_sym
Traceback (most recent call last):
File "kicad_sym.py", line 781, in <module>
a = KicadLibrary.from_file(sys.argv[1])
File "kicad_sym.py", line 698, in from_file
sexpr_data = sexpr.parse_sexp(lines)
AttributeError: module 'sexpr' has no attribute 'parse_sexp'
I went on to check methods for sexpr
module and indeed parse_sexp
is not one of them:
(env) $ python
Python 3.8.6 (default, Oct 6 2020, 03:22:36)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sexpr
>>> dir(sexpr)
['Any', 'Callable', 'Dict', 'Grammar', 'Optional', 'Sexpr', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', 'extend', 'find_and_replace', 'find_child', 'find_descendant', 'grammar', 'inject', 'load', 'load_dict', 'load_file', 'load_string', 'loaders', 'matcher', 'pprint', 'print', 'register', 'sexpr', 'types', 'utils', 'yaml']
The Connector.kicad_sym
library file used for my testing was downloaded from the official v6 library here.
Potential Solution
Please include a requirements.txt
for external dependencies, I may not have installed the right sexpr
module version?
Or is it possible I am missing something else?
It would also be nice to have a set of installation instructions in the README, if necessary.
Edited by cpresser