Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on pasting text. #54

Open
welbornprod opened this issue Sep 7, 2014 · 2 comments
Open

Crash on pasting text. #54

welbornprod opened this issue Sep 7, 2014 · 2 comments

Comments

@welbornprod
Copy link

The report was this:

Variables:
File "/home/cj/.local/lib/python2.7/site-packages/dreampielib/gui/init.py", line 960, on_execute_command(self=DreamPie(path..."window_main"), _widget=<gtk.Men...27979a0)>)
{'self.execute_source': <bound method DreamPie.execute_source of DreamPie(path="/home/cj/.local/lib/python2.7/site-packages/dreampielib/data/dreampie.glade", root="window_main")>}
File "/home/cj/.local/lib/python2.7/site-packages/dreampielib/gui/init.py", line 497, execute_source(self=DreamPie(path..."window_main"))
{'is_ok': [], 'syntax_error_info': [], 'source': u'doc = """

<.....~60 lines of html string omitted here, because GitHub is trying to parse it. ...>

"""', 'self.call_subp': <bound method DreamPie.call_subp of DreamPie(path="/home/cj/.local/lib/python2.7/site-packages/dreampielib/data/dreampie.glade", root="window_main")>}

Traceback (most recent call last):
File "/home/cj/.local/lib/python2.7/site-packages/dreampielib/gui/init.py", line 960, in on_execute_command
self.execute_source()
File "/home/cj/.local/lib/python2.7/site-packages/dreampielib/gui/init.py", line 497, in execute_source
is_ok, syntax_error_info = self.call_subp(u'execute', source)
TypeError: 'NoneType' object is not iterable

@welbornprod
Copy link
Author

I can reproduce it by restarting DreamPie and pasting it again. Since github is trying to parse the html I pasted the failing text on my site:

http://welbornprod.com/paste/?id=gezx

It's not code that goes into any of my programs, just a small test I was running with lxml.html.

@welbornprod
Copy link
Author

I know what caused it. I had embedded python code inside of that string, with docstrings in it.

So.. this made it crash:
txt = """ <-html stuff-> """ python stuff """ <-more html stuff-> """

The fix was to do this:

txt = ''' <-html stuff-> """ python stuff """ <- more html stuff -> '''

(just changed the triple-quote style)

Oddly, I discovered it by reverting back to IDLE, where I got SyntaxError: invalid syntax. When I saw that I immediately realized what had happened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants