4 ms·
Hm, haven't tried it, but doing this should be much easier: 0 0 * * * /path/to/interpreter/created/by/poetry/bin/python myscript.py
by Chiron1991 6y ago
Hm, haven't tried it, but doing this should be much easier:
0 0 * * * /path/to/interpreter/created/by/poetry/bin/python myscript.py
- hprotagonist 6y agothis is precisely correct.
- EE84M3i 6y agoDoes bin/python in a virtualenv set PYTHONHOME correctly..?
- remlov 6y agoYes. And the answer by Chiron1991 is the proper way to do this since pretty much forever.
- EE84M3i 6y agoStrange, this does seem to work with python3.8 on ubuntu 20.04 (the site-packages shows up in sys.path), but for me in a virtualenv bin/python is a symlink to the system python, so how does python 'know' what path to use? Is there logic baked into the interpreter? I seem to recall that with python2.7 that calling bin/python in a virtualenv without activating the virtualenv did not used to "work" (i.e. it would use the system packages). Did this change at some point or is my memory just wrong?
- jalons 6y agoYes, if the python interpreter the poetry environment utilizes is in your $PATH.