FreeBSD 11.1 - Subliminal: env: python: No such file or directory
Closed this issue ยท 7 comments
When post-processing the following error was logged by nzbget:
Subliminal: env: python: No such file or directory
The issue was resolved by changing line 1 in Subliminal.py from:
#!/usr/bin/env python
to
#!/usr/bin/env python2
Hi!
I think you might find that you have more compatibility with python scripts and tools other people write if you do the following:
# as root:
ln -s /usr/local/bin/python2 /usr/local/bin/python
Running Subliminal.py
from the shell worked fine. Running env python
from shell also resulted in python 2.x being executed. It wasn't until I made this change that post-processing would work without resulting in an error in nzbget 19.1. If I undo the change and run post-processing again the error returns.
The suggested symlink also exists on FreeBSD already:
# ls -al /usr/local/bin/ | grep python
lrwxr-xr-x 1 root wheel 7 Jul 31 11:01 python -> python2
I don't know if I'm a unique case but I thought I should at least report it.
Ah, I thought it wasn't working for you from the shell prompt! My apologies! ๐
I wonder if there is a way to tell NZBGet the interpreter to use another way. @hugbug, I hate bugging you but do you have any thoughts? How do you handle FreeBSD users for all of your other scripts?
No need to apologise ๐
I can tell you EMail.py
and Logger.py
have the following line on my FreeBSD system: #!/usr/local/bin/python2.7
. In nzbget's repistory they have the line #!/usr/bin/env python
.
I built nzbget using the ports collection (/usr/ports/news/nzbget
) and just rebuilt/reinstalled it to verify the change in EMail.py
and Logger.py
. Also if I do a make extract
which unpacks the files used to built the port and look in the work directory for the scripts EMail.py
and Logger.py
they come with the line #!/usr/bin/env python
. I can't say for certain but it seems building from ports results in the python files being modified to #!/usr/local/bin/python2.7
.
My only concern is that I use CentOS (yes, yes, I know, I'm a dinosaur ๐ ), and the path for me is /usr/bin/python. #!/usr/bin/env python is supposed to be the goto thing to be platform independent (*nux based) where as hard coding paths isn't. I realize what your suggesting isn't to fix the paths, but based on your issue, python isn't in the $path when being launched by NZBGet. Either that or NZBGet is using it's own method to determine what the interpreter should be (to call the script) and can't seem to locate your copy of python (or know to use it). The fact it works from the command line tells me the bug may not be with the script itself. I'll wait for Hugbug to chime in.
I think I found the issue. Oversight on my part as I should have also checked /usr/bin
after your first reply. From what I can tell nzbget has /usr/bin
in its env path but not /usr/local/bin
. /usr/bin
does contain python2 but not the symlink to python by default on FreeBSD. This explains why env python2
does work but env python
does not.
I think the issue can be closed and I should probably take it up with the FreeBSD ports maintainer for nzbget or python to see if they can resolve this by adding this symlink during installation. Perhaps you can consider making a note of it somewhere incase someone else runs into this issue.
That's great news! I'm glad you figured it out!
Perhaps you can consider making a note of it somewhere incase someone else runs into this issue.
Your issue has now been forever burned into my memory and this ticket will forever be on the internet. ๐ Not to mention the title you set for this ticket is perfect and explains the exact issue. I'm hopeful as a result, those with the similar problem will find your ticket when doing a Google search (as it will eventually get indexed there).
All that said though...should I get more issues on this, I'll certainly follow through with your request make a public note about it! Don't hesitate to open a ticket if you have any issues at all!