pixelb / fslint

Linux file system lint checker/cleaner
319 stars 72 forks source link

SyntaxError: invalid syntax Ubuntu Python2 Solution #111

Closed upthewazoo closed 9 years ago

upthewazoo commented 9 years ago

Platform: Ubuntu 15.04 64bit

fs-lint installation: $ sudo apt-get install fslint

fs-lint version: $ fslint-gui --version FSlint 2.44

PROBLEM: $ fslint-gui File "/usr/bin/fslint-gui", line 182 except getopt.error, msg: ^ SyntaxError: invalid syntax

SOLUTION: $ sudo nano /usr/bin/fslint-gui

Replace the old shebag line:

!/usr/bin/env python

With the new shebang line:

!/usr/bin/env python2

This is just one of the many small issues from having the old Python2 interpreter being slowly deprecated in Linux distributions as the new Python3 interpreter is being deployed as the default Python interpreter in Linux distros today.

Immediate term solution: manually edit your own individual fslint-gui to force to use the correct Python interpreter. This still leaves everyone else up the creek without a paddle.

Short term solution: push this modification within distros moving to Python3 as the default Python interpreter.

Long term solution: Write a Python2 & Python3 aware and compatible version of fslint-gui python code and distribute that. Eventually Python2 support can be deprecated but that is a while off yet at this exact date in time.

ADDENDUM: I did a cursory look at the fslint support files as well $ head -n 1 * in all the fslint support files directories under /usr/share/fslint

and found a really nasty shebang in the md5 module and a couple more env python shebangs that I overwrote to env python2 shebang calles... the nasty md5 module I just made it a proper env call rather than a nasty direct python call from /usr/bin.

Now it seems to run fine without any errors on Ubuntu 15.04 and I am assuming the same will make it run find on my Arch and other distros as well.

pixelb commented 9 years ago

should be fixed already with commit 70568e6e