🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #87290

PyClean installation

#87290
From: Julien ÉLIE
Date: Sun, 13 Dec 2015 21:00
105 lines
3936 bytes
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)

Technical Details
Message-ID: <n4km8u$1ra$1@news.trigofacile.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.(19219).mbox.7z!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <n4km8u$1ra$1@news.trigofacile.com>
Subject: PyClean installation
Date: Sun, 13 Dec 2015 22:00:13 +0100
From: Julien ÉLIE <iulius@nom-de-mon-site.com.invalid>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.(19219).mbox.7z!not-for-mail
Newsgroups: news.software.nntp
Organization: TrigoFACILE -- http://www.trigofacile.com/
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 13 Dec 2015 21:00:14 -0000 (UTC)
Injection-Info: news.trigofacile.com; posting-account="julien"; posting-host="aaubervilliers-651-1-216-248.w83-114.abo.wanadoo.fr:83.114.167.248";
 logging-data="1898"; mail-complaints-to="abuse@trigofacile.com"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0)
 Gecko/20100101 Thunderbird/38.4.0
X-Mozilla-News-Host: news://news.individual.net:119
X-Received-Body-CRC: 1665704103
X-Received-Bytes: 3899