SyntaxErrors all over the place
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
RefreshNG |
New
|
Undecided
|
Unassigned |
Bug Description
Really uncertain how to report this bug but I'll try.
I'm trying to refresh a otherwise working fine product of mine which refreshes fine in zope 2.8.5. This time I'm trying the same product in zope 2.10.5.
The error I get looks something like this:
2007-12-12 16:31:04 INFO Refresh Refreshing product MExpenses
2007-12-12 16:31:04 ERROR Refresh Exception while refreshing MExpenses
Traceback (most recent call last):
File "/home/
if not performRefresh(jar, productid):
File "/home/
r.reload()
File "/home/
code = compile(source, filename, "exec")
File "/home/
^
SyntaxError: invalid syntax
There is no syntax error in that file. Line 336 is the very last line and it's blank.
Line 71 in xreload.py does this::
code = compile(source, filename, "exec")
I injected this line just before to get a copy of the read source code:
open('/tmp/%s' % os.path.
code = compile(source, filename, "exec")
Running them from the /tmp directory with the same Python doesn't work because of the lack of other stuff but at least it doesn't raise a SyntaxError.
Any idea?
The patch is dumb-easy but made all the difference. This is simply a standard Python "limitation":
peterbe@ trillian: /tmp $ python2.4 .read() source) )[-50:] usercookie( uid, key)\n '
Python 2.4.4 (#2, Apr 12 2007, 21:03:11)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> filename = 'UserCookies.py'
>>> source = open(filename)
>>> print str(repr(
n self._del_
>>> compile(source, filename, 'exec')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "UserCookies.py", line 29
SyntaxError: invalid syntax source. strip() +'\n', filename, 'exec')
>>> compile(
<code object ? at 0xb79ee120, file "UserCookies.py", line 1>