Old Paranoia Game in Python
ptmcg at austin.rr._bogus_.com
Tue Jan 11 15:12:16 CET 2005
"McBooCzech" <petr at tpc.cz> wrote in message
news:1105400673.731851.87080 at f14g2000cwb.googlegroups.com...
> Newbie in Python.
> I did copy the whole script form the web and save it as para1.py. I did
> download pyparsing module and save it to
> I did run following script:
> import sys
> from pyparsing import *
> extraLineBreak = White(" ",exact=1) + LineEnd().suppress()
> text = file("Para1.py").read()
> newtext = extraLineBreak.transformString(text)
> I did try to run para2.py script, but following message
> File "para2.py", line 169
> choose(4,"You give your correct clearance",5,"You lie and claim
> SyntaxError: EOL while scanning single-quoted string
> So my questions are:
> Why pyparser didn't correct the script?
> What I am doing wrong?
> Is it necessary to correct the script by hand anyway?
After running the little script, I still had to make one correction by hand,
on line 1057. There was a line that needed to be indented that wasn't.
This little pyparsing script only takes out the line-breaks that were added
because of the news server's word wrapping algorithm, and does not catch
indentation errors. After correcting that by hand, I ran the program
Did you extract *just* the Python code in the previous post? I did not find
the line you listed as line 169 in either my pre-pyparsing nor
post-pyparsing versions of the program. In para1.py, your line 169 shows up
as my line 159, in para2.py, it is line 152, and it looks like:
choose(4,"You give your correct clearance",5,"You lie and claim
(of course, this is likely to get word-wrapped again, but the point is, it
includes the rest of the quoted string after the word 'claim').
What encoding are you using? I am currently working on a Unicode-compatible
pyparsing, and this may help resolve your problem. Since your e-mail domain
country code is cz, it's possible that the encoding for spaces and/or line
breaks is treated differently. This is just a wild guess.
Anyway, in the interest of tracking down a potential pyparsing problem,
could you please e-mail me your para1.py file?
More information about the Python-list