Spyce compiler newline sensitivity?

Philip Semanchuk <[email protected]>
Newsgroups gmane.comp.python.spyce.general
Message-ID <[email protected]>
Hi all,
It's Philip with another weird problem. I use Spyce to generate Spyce  
code which has worked well up until this point. Today I found some code  
that causes the compilation step to exit ungracefully  
("spyceSyntaxError: <unprintable instance object>"). What's really odd  
is that the code compiles OK if I save it in TextEdit (I'm on a Mac)  
and only fails to compile if I save it in BBEdit, which I use to save  
*all* of my Spyce, Python and HTML files and have not had a problem  
with up until this point. The files only differ in their newlines.

Here's the code which has been stripped down to a minimal test case:
[[\
OpenBrackets = "[" * 2
CloseBrackets = "]" * 2

s = r"""

%(OpenBrackets)s\

if True == False:
     pass

%(CloseBrackets)s

""" % vars()

]]


A hex dump of the files (compiling and non-compiling versions) shows  
that they're the same size, but the TextEdit version uses 0x0D as  
newlines and ends the file with 0x0D 0x0A, while the BBEdit version  
uses 0x0A as newlines and ends the file with 0x0A 0x0A.

I created a tarball and a zip file (same contents in each) that contain  
the two versions of the code as well as a hex dump of each. Those files  
are here:
http://semanchuk.com/philip/temp/SpyceNewlineCode.tar.gz
http://semanchuk.com/philip/temp/SpyceNewlineCode.zip

I'd appreciate it if anyone else would be willing to try to compile  
these files and report the results.

Thanks
Philip


PS - here's the error I get with the version that fails to compile:
$ /usr/local/spyce-2.0.3/spyceCmd.py -c CompileFails.spy
cache miss for ('/usr/local/spyce-2.0.3/modules/error.py',  
'defaultErrorTemplate')
cache miss for ('/usr/local/spyce-2.0.3/tags/core.py', 'core')
cache miss for ('/usr/local/spyce-2.0.3/tags/form.py', 'form')
generating new spyceCode for test4.spy
cache hit (1116524720) for core in /usr/local/spyce-2.0.3/tags/core.py
cache hit (1115998066) for form in /usr/local/spyce-2.0.3/tags/form.py
Traceback (most recent call last):
   File "/usr/local/spyce-2.0.3/spyceCmd.py", line 297, in spyceMain
     s = server.spyce_cache['file', script]
   File "/usr/local/spyce-2.0.3/spyceCache.py", line 145, in __getitem__
     return self.get(key)
   File "/usr/local/spyce-2.0.3/spyceCache.py", line 133, in get
     self.cache[key] = self.generate(key)
   File "/usr/local/spyce-2.0.3/spyce.py", line 819, in  
spyceCacheGenerate
     return {
   File "/usr/local/spyce-2.0.3/spyce.py", line 798, in  
spyceFileCacheGenerate
     s = spyceCode(code, filename=filename, sig=sig)
   File "/usr/local/spyce-2.0.3/spyce.py", line 492, in __init__
     self._code, self._coderefs, self._modrefs = \
   File "/usr/local/spyce-2.0.3/spyceCompile.py", line 1437, in  
spyceCompile
     refs = emitPython(out, bracedPythonCode, refs)
   File "/usr/local/spyce-2.0.3/spyceCompile.py", line 1384, in  
emitPython
     tokenize.tokenize(StringIO(bracedPythonCode).readline, eatToken)
   File  
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3/tokenize.py", line 153, in tokenize
     tokenize_loop(readline, tokeneater)
   File  
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3/tokenize.py", line 160, in tokenize_loop
     tokeneater(*token_info)
   File "/usr/local/spyce-2.0.3/spyceCompile.py", line 1382, in eatToken
     raise spyceException.spyceSyntaxError(sys.exc_info()[0])
spyceSyntaxError: <unprintable instance object>




-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.