Hi,
At last I'm having a look at the installation of PyClean
https://github.com/crooks/PyClean
I noted two portability issues:
* File "/usr/lib/python2.4/site-packages/pyclean/pyclean.py", line 149
class Binary():
^
SyntaxError: invalid syntax
Changing
class Binary():
to
class Binary:
fixes the issue. That syntax should also be enforced to other "class
xxx():" in pyclean.py.
* File "/usr/lib/python2.4/site-packages/pyclean/pyclean.py", line 264
bad_files = {f: 0 for f in bad_file_list}
^
SyntaxError: invalid syntax
Dict comprehensions are only available in Python 2.7 upwards. I suggest
to use the legacy syntax:
bad_files = dict((f, 0) for f in bad_file_list)
Well, after these two fixes for older versions of Python, I do not
manage to run pyclean.py.
Note that the install path is different from the one mentioned in INSTALL:
"Assuming the standard locations have been used, the following
commands can be issued:-
cd ~news/bin/filter
ln -s /usr/local/lib/python2.x/dist-packages/pyclean/pyclean.py
filter_innd.py
"
I have /usr/lib/python2.4/site-packages/pyclean/pyclean.py instead of
dist-packages.
INN.py and filter_innd.py are in "~news/bin/filter".
I have set PYTHONPATH to ".:~news/bin/filter" for the news user.
Otherwise, I have:
%python pyclean.py
Traceback (most recent call last):
File "pyclean.py", line 3, in ?
import INN
ImportError: No module named INN
But with PYTHONPATH set to ".:~news/bin/filter", I have:
% python filter_innd.py
Traceback (most recent call last):
File "filter_innd.py", line 4, in ?
from pyclean.Config import config
File "/usr/lib/python2.4/site-packages/pyclean/pyclean.py", line 4, in ?
from pyclean.Config import config
ImportError: No module named Config
and naturally:
% ctlinnd reload filter.python "PyClean initial load"
ctlinnd: Failed to reload filter_innd.py
I do not understand why pyclean.Config is not found.
Especially, when I have:
% python -c "import sys; print sys.path"
['', '/home/news', '/home/news/bin/filter', '/usr/lib/python24.zip',
'/usr/lib/python2.4', '/usr/lib/python2.4/plat-linux2',
'/usr/lib/python2.4/lib-tk', '/usr/lib/python2.4/lib-dynload',
'/usr/local/lib/python2.4/site-packages',
'/usr/lib/python2.4/site-packages', '/var/lib/python-support/python2.4']
% python -c "from pyclean.Config import config ; print 'OK'"
OK
So the import seems to work fine...
Steve, do you have any recommendation usage related to paths to make it
work? Is it the right thing I am doing to install PyClean?
--
Julien ÉLIE
« – Il est parti comme il est venu…
– Il ne faisait que passer… » (Astérix)