Page 1 of 1
0.3.2 "SyntaxError: invalid syntax" with python 2.4
Posted: February 26th, 2008, 7:17 pm
by jcfp
Latest version doesn't seem to like python 2.4, although it is listed as supported in INSTALL.txt; the following error is found on startup when using python 2.4 (2.4.4-6ubuntu4 to be exact) on Ubuntu Gutsy:
Code: Select all
$ python2.4 ./SABnzbd.py
Traceback (most recent call last):
File "./SABnzbd.py", line 26, in ?
import sabnzbd
File "/home/jp/devel/sabnzbdplus/motu-hardy/misc/SABnzbd-0.3.2/sabnzbd/__init__.py", line 37, in ?
from sabnzbd.assembler import Assembler, PostProcessor
File "/home/jp/devel/sabnzbdplus/motu-hardy/misc/SABnzbd-0.3.2/sabnzbd/assembler.py", line 36, in ?
from sabnzbd.newsunpack import unpack_magic, par2_repair, external_processing
File "/home/jp/devel/sabnzbdplus/motu-hardy/misc/SABnzbd-0.3.2/sabnzbd/newsunpack.py", line 678
finally:
^
SyntaxError: invalid syntax
Program starts fine when using python 2.5.
Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4
Posted: February 26th, 2008, 7:56 pm
by switch
Looks like you can't have an 'except' and 'finally' under the same 'try' block in versions lower than 2.5. They need to be nested instead like so:
try:
try:
except:
finally:
shypike has control over this, and I'm sure he'll issue a fix when he is aware of this tomorrow.
Sorry for any inconvenience, not sure how this slipped through our testing.
Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4
Posted: February 27th, 2008, 3:50 am
by shypike
The reason it slipped through is quite simple.
We do not test with Python 2.4.
I'll see if we can whip up a 0.3.3 asap.
Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4
Posted: February 27th, 2008, 7:31 am
by switch
0.3.3 seems a little overboard for it just affecting python 2.4 users.
How about 0.3.2R2 (release 2) and have not detect it as a new release in the version checker.
The windows versions need not be changed, just the sources.
Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4
Posted: February 27th, 2008, 7:43 am
by neilt0
0.3.2.1!
3....2....1....Launch!
Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4
Posted: February 27th, 2008, 10:39 am
by jangey
I ran into this same error yesterday while running python 2.4. After reading this post I upgraded to python v.2.5.2 and am still receiving the same error.
[root@dC SABnzbd-0.3.2]# python SABnzbd.py
Traceback (most recent call last):
File "SABnzbd.py", line 26, in
import sabnzbd
File "/root/SABnzbd-0.3.2/sabnzbd/__init__.py", line 37, in
from sabnzbd.assembler import Assembler, PostProcessor
File "/root/SABnzbd-0.3.2/sabnzbd/assembler.py", line 37, in
from sabnzbd.interface import CheckFreeSpace
File "/root/SABnzbd-0.3.2/sabnzbd/interface.py", line 38, in
from cherrypy.filters.gzipfilter import GzipFilter
ImportError: No module named filters.gzipfilter
[root@fueltrace SABnzbd-0.3.2]# python -V
Python 2.5.2
(Running CentOS 5)
Any suggestions?
Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4
Posted: February 27th, 2008, 10:57 am
by switch
Have you used the previous versions before?
Do you have CherryPy2 installed? SABnzbd requires the following modules
Essential modules
CherryPy-2.2.1
http://www.cherrypy.org
cheetah-2.0.1
http://www.cheetahtemplate.org/
elementtree-1.2.6
http://effbot.org/downloads/
yenc module >= 0.3
http://sabnzbd.sourceforge.net/yenc-0.3.tar.gz
http://sabnzbd.sourceforge.net/yenc-0.3-w32fixed.zip (Win32-only)
par2cmdline >= 0.4
http://parchive.sourceforge.net/
Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4
Posted: February 27th, 2008, 1:05 pm
by jangey
No, I haven't used other versions before.. I tried a roll back to 0.3.1 with Python2.4 and 2.5 and I'm getting the same errors as before.
I have all the modules installed, python is reporting:
[root@dC ~]# /usr/local/bin/python
Python 2.5.2 (r252:60911, Feb 26 2008, 17:52:22)
[GCC 4.1.1 20070105 (Red Hat 4.1.1-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cherrypy
>>> import Cheetah
>>> import elementtree
>>> import yenc
>>> import feedparser
[root@dC ~]#
and I have par2cmdline installed:
[root@fueltrace ~]# par2 /?
Not enough command line arguments.
par2cmdline version 0.4, Copyright (C) 2003 Peter Brian Clements.
Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4
Posted: February 27th, 2008, 1:15 pm
by switch
If "import cherrypy" works ok, but "from cherrypy.filters.gzipfilter import GzipFilter"
doesn't work, then I am guessing you have cherrypy 3 installed.
Can you please see what version is installed?
Code: Select all
import cherrypy
cherrypy.__version__
Should be version 2.2.1
Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4
Posted: February 27th, 2008, 1:43 pm
by jangey
Good catch.. I had CherryPy3 installed.. I have removed all cherrypy3 references from /usr/local/lib/python2.5/site-packages and installed CherryPy2.2.1.
I am still getting:
SABnzbd-0.3.1 and Python2.5
Code: Select all
[root@dC SABnzbd-0.3.1]# /usr/local/bin/python SABnzbd.py -f sabnzbd.ini
Traceback (most recent call last):
File "SABnzbd.py", line 26, in <module>
import sabnzbd
File "/root/SABnzbd-0.3.1/sabnzbd/__init__.py", line 37, in <module>
from sabnzbd.assembler import Assembler, PostProcessor
File "/root/SABnzbd-0.3.1/sabnzbd/assembler.py", line 37, in <module>
from sabnzbd.interface import CheckFreeSpace
File "/root/SABnzbd-0.3.1/sabnzbd/interface.py", line 38, in <module>
from cherrypy.filters.gzipfilter import GzipFilter
File "/usr/local/lib/python2.5/site-packages/cherrypy/filters/gzipfilter.py", line 3, in <module>
import zlib
ImportError: No module named zlib
[root@dC SABnzbd-0.3.1]#
SABnzbd-0.3.2 and Python2.5
Code: Select all
[root@dC SABnzbd-0.3.2]# /usr/local/bin/python SABnzbd.py
Traceback (most recent call last):
File "SABnzbd.py", line 26, in <module>
import sabnzbd
File "/root/SABnzbd-0.3.2/sabnzbd/__init__.py", line 37, in <module>
from sabnzbd.assembler import Assembler, PostProcessor
File "/root/SABnzbd-0.3.2/sabnzbd/assembler.py", line 37, in <module>
from sabnzbd.interface import CheckFreeSpace
File "/root/SABnzbd-0.3.2/sabnzbd/interface.py", line 38, in <module>
from cherrypy.filters.gzipfilter import GzipFilter
File "/usr/local/lib/python2.5/site-packages/cherrypy/filters/gzipfilter.py", line 3, in <module>
import zlib
ImportError: No module named zlib
[root@dC SABnzbd-0.3.2]#
Python is reporting:
Python 2.5.2 (r252:60911, Feb 26 2008, 17:52:22)
[GCC 4.1.1 20070105 (Red Hat 4.1.1-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cherrypy
>>>
Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4
Posted: February 27th, 2008, 2:01 pm
by jangey
I should have read my own error message: RE Zlib

.. I've reinstalled current zlib with ./configure --share and then recompiled python2.5. My new errors are:
Code: Select all
[root@dC SABnzbd-0.3.2]# python SABnzbd.py
Traceback (most recent call last):
File "SABnzbd.py", line 692, in <module>
main()
File "SABnzbd.py", line 386, in main
cherrypylogging = bool(check_setting_int(cfg, 'logging', 'enable_cherrypy_logging', 1))
File "/root/SABnzbd-0.3.2/sabnzbd/__init__.py", line 180, in check_setting_int
config[cfg_name][item_name] = my_val
File "/root/SABnzbd-0.3.2/sabnzbd/utils/configobj.py", line 375, in __getitem__
val = dict.__getitem__(self, key)
KeyError: 'logging'
New python build still reporting:
Python is reporting:
Python 2.5.2 (r252:60911, Feb 26 2008, 17:52:22)
[GCC 4.1.1 20070105 (Red Hat 4.1.1-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cherrypy
>>>
Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4
Posted: February 27th, 2008, 2:15 pm
by shypike
Looks like a mutilated sabnzbd.ini file.
Remove it and retry.
Send the whole logfile to
[email protected] when this persists.
Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4
Posted: February 27th, 2008, 2:43 pm
by jangey
Yep, thats it. I forgot I moved the 0.3.1 .ini to the 0.3.2 build- All is working. Thanks