Antwane Mason schreef op di 07-09-2021 om 13:39 [-0400]: > Has anyone come across the following runtime error when running a python-based > application in guix? I'm wondering if something went wrong during the package build > for python-onlykey-agent that messed up the PYTHONPATH export for the runtime. I should > note that python-onlykey-agent is a program that I have packaged to eventually submit to guix. > > --8<---------------cut here---------------start------------->8--- > export PYTHONPATH="...:/gnu/store/wand0zrwwnds6x636746116cfh3sy50k-python-pyopenssl-20.0.0/lib/python3.8/site-packages${PYTHONPATH:+:}$PYTHONPATH" > > SyntaxError: invalid syntax > --8<---------------cut here---------------end--------------->8--- > Here is the entire stack trace for reference. > > --8<---------------cut here---------------start------------->8--- > antwane@wmguix ~$ onlykey-agent git@github.com > Traceback (most recent call last): > File "/gnu/store/s2w1lq80x9vcwp5382kn98f5pi2k4b7b-python-onlykey-agent-1.1.12/bin/.onlykey-agent-real", line 11, in > load_entry_point('onlykey-agent==1.1.12', 'console_scripts', 'onlykey-agent')() > File "/gnu/store/sd2ic7bpv8fx3imy1j8xcjclx71sv6q0-python-3.8.2/lib/python3.8/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point > return get_distribution(dist).load_entry_point(group, name) > File "/gnu/store/sd2ic7bpv8fx3imy1j8xcjclx71sv6q0-python-3.8.2/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2852, in load_entry_point > return ep.load() > File "/gnu/store/sd2ic7bpv8fx3imy1j8xcjclx71sv6q0-python-3.8.2/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2443, in load > return self.resolve() > File "/gnu/store/sd2ic7bpv8fx3imy1j8xcjclx71sv6q0-python-3.8.2/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2449, in resolve > module = __import__(self.module_name, fromlist=['__name__'], level=0) > File "/gnu/store/s2w1lq80x9vcwp5382kn98f5pi2k4b7b-python-onlykey-agent-1.1.12/bin/onlykey_agent.py", line 2 Why is "onlykey_agent.py" in "bin"? If it is not a stand-alone library, shouldn't it be in "share" or "lib"? Anyway, to prevent onlykey_agent.py from being wrapped, you can replace the 'wrap' phase with a custom 'wrap' phase adjusted for onlykey-agent pecularities: (package (name "python-onlykey-agent") ... (arguments `(#:phases (modify-phases %standard-phases (replace 'wrap (lambda* (#:key outputs #:allow-other-keys) (define bin (string-append (assoc-ref outputs "out") "/bin") ;; Replace ??? with something appropriate for onlykey-agent (wrap-program (string-append bin "/onlykey-agent) `("PYTHONPATH" '??? '???)) 'maybe-wrap-other-things '???)))))) Greetings, Maxime.