0.3.2 "SyntaxError: invalid syntax" with python 2.4

Report & discuss bugs found in SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
User avatar
jcfp
Release Testers
Release Testers
Posts: 986
Joined: February 7th, 2008, 12:45 pm

0.3.2 "SyntaxError: invalid syntax" with python 2.4

Post 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.
User avatar
switch
Moderator
Moderator
Posts: 1380
Joined: January 17th, 2008, 3:55 pm
Location: UK

Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4

Post 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.
Last edited by switch on February 26th, 2008, 7:59 pm, edited 1 time in total.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4

Post 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.
Last edited by shypike on February 27th, 2008, 3:54 am, edited 1 time in total.
User avatar
switch
Moderator
Moderator
Posts: 1380
Joined: January 17th, 2008, 3:55 pm
Location: UK

Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4

Post 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.
User avatar
neilt0
Full Member
Full Member
Posts: 120
Joined: January 22nd, 2008, 4:16 am

Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4

Post by neilt0 »

0.3.2.1!

3....2....1....Launch!
jangey
Newbie
Newbie
Posts: 5
Joined: February 27th, 2008, 10:35 am

Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4

Post 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?
User avatar
switch
Moderator
Moderator
Posts: 1380
Joined: January 17th, 2008, 3:55 pm
Location: UK

Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4

Post 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/
jangey
Newbie
Newbie
Posts: 5
Joined: February 27th, 2008, 10:35 am

Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4

Post 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.
User avatar
switch
Moderator
Moderator
Posts: 1380
Joined: January 17th, 2008, 3:55 pm
Location: UK

Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4

Post 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
jangey
Newbie
Newbie
Posts: 5
Joined: February 27th, 2008, 10:35 am

Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4

Post 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
>>>
jangey
Newbie
Newbie
Posts: 5
Joined: February 27th, 2008, 10:35 am

Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4

Post 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
>>>
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4

Post by shypike »

Looks like a mutilated sabnzbd.ini file.
Remove it and retry.
Send the whole logfile to [email protected] when this persists.
jangey
Newbie
Newbie
Posts: 5
Joined: February 27th, 2008, 10:35 am

Re: 0.3.2 "SyntaxError: invalid syntax" with python 2.4

Post by jangey »

Yep, thats it. I forgot I moved the 0.3.1 .ini to the 0.3.2 build- All is working. Thanks
Post Reply