borgbackup/borg-import

Bad error message when run against python-2.7

tuxick opened this issue · 4 comments

When default python is 2.7, the result of running setup.py is:

./setup.py
import-im6.q16: unable to open X server ' @ error/import.c/ImportImageCommand/358. from: too many arguments ./setup.py: line 5: syntax error near unexpected token ('
./setup.py: line 5: `min_python = (3, 4)'

Nothing special here:

tw@tux:~/w/borg-import$ python --version
Python 2.7.12
tw@tux:~/w/borg-import$ python setup.py 
borg-import requires Python 3.4 or later

But when invoking setup.py directly:

tw@tux:~/w/borg-import$ chmod +x setup.py 
tw@tux:~/w/borg-import$ ./setup.py
from: can't read /var/mail/setuptools
./setup.py: line 5: syntax error near unexpected token `('
./setup.py: line 5: `min_python = (3, 4)'

The /var/mail/setuptools error msgs is weird.

Ah, there is no shebang (#!) line in this file, so when starting it directly, it uses bash (or whatever shell you use) to interpret it...

Using bash, import sys invokes this:

import(1)                   General Commands Manual                  import(1)

NAME
       import  -  saves any visible window on an X server and outputs it as an
       image file. You can capture a single window, the entire screen, or  any
       rectangular portion of the screen.

So, the resulution here is "don't interpret python files with bash". :)

omg, I can't believe this one got me too. lol