Invalid Syntax Error

146 views
Skip to first unread message

Matt Sowden

unread,
Oct 17, 2013, 12:38:35 PM10/17/13
to qu...@googlegroups.com
Hey there,

This may be a silly problem, but I seem to be coming across syntax errors when I'm trying to run examples such as the Freebase and DBPedia examples packaged with the package from pip and from github master.

Here's a traceback:

Traceback (most recent call last):
  File "main.py", line 20, in <module>
    import quepy
  File "/usr/local/lib/python2.6/dist-packages/quepy-0.2-py2.6.egg/quepy/__init__.py", line 17, in <module>
    from quepy.quepyapp import install, QuepyApp
  File "/usr/local/lib/python2.6/dist-packages/quepy-0.2-py2.6.egg/quepy/quepyapp.py", line 19, in <module>
    from quepy import generation
  File "/usr/local/lib/python2.6/dist-packages/quepy-0.2-py2.6.egg/quepy/generation.py", line 19, in <module>
    from quepy.mql_generation import generate_mql
  File "/usr/local/lib/python2.6/dist-packages/quepy-0.2-py2.6.egg/quepy/mql_generation.py", line 43
    graph = {node: [] for node in e.iter_nodes()}

Any thoughts?
-M.

Gonzalo García Berrotarán

unread,
Oct 17, 2013, 1:34:44 PM10/17/13
to qu...@googlegroups.com
Hi there, thanks for the report but i think this traceback is not complete.
It appears to be missing the last part where it describes exactly the line of the invalid syntax.

Would you mind sending it again with the complete output including the command you're running so we can test it ourselves?

Thanks, regards!


--
You received this message because you are subscribed to the Google Groups "Quepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quepy+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Matt Sowden

unread,
Oct 17, 2013, 5:01:24 PM10/17/13
to qu...@googlegroups.com
Hi,

Here's a full traceback including the command line:

yuukari@polaris:~/share/quepy/examples/freebase$ python main.py Who is the president of Apple?
Traceback (most recent call last):
  File "main.py", line 15, in <module>
    import quepy
  File "/usr/local/lib/python2.6/dist-packages/quepy-0.2-py2.6.egg/quepy/__init__.py", line 17, in <module>
    from quepy.quepyapp import install, QuepyApp
  File "/usr/local/lib/python2.6/dist-packages/quepy-0.2-py2.6.egg/quepy/quepyapp.py", line 19, in <module>
    from quepy import generation
  File "/usr/local/lib/python2.6/dist-packages/quepy-0.2-py2.6.egg/quepy/generation.py", line 19, in <module>
    from quepy.mql_generation import generate_mql
  File "/usr/local/lib/python2.6/dist-packages/quepy-0.2-py2.6.egg/quepy/mql_generation.py", line 43
    graph = {node: [] for node in e.iter_nodes()}
                        ^
SyntaxError: invalid syntax
yuukari@polaris:~/share/quepy/examples/freebase$

Rafael Carrascosa

unread,
Oct 17, 2013, 9:54:34 PM10/17/13
to qu...@googlegroups.com
Hi Matt,

Quepy is meant to run in Python 2.7, so the problem you see is that Python 2.6 does not support dictionary comprehensions. Then that innocent line "graph = {node: [] for node in e.iter_nodes()}" blows up as a syntax error.
Two options:
 - Patch that line to "graph = dict((node, []) for node in e.iter_nodes())"
 - Use Python 2.7

Best regards,

Rafael

Matt Sowden

unread,
Oct 17, 2013, 11:19:02 PM10/17/13
to qu...@googlegroups.com
Yep, there it is. Thanks for that! I didn't realize that! The more you learn I suppose :)

-M.

Gunnar Aastrand Grimnes

unread,
Oct 18, 2013, 12:55:55 AM10/18/13
to qu...@googlegroups.com

This line is a dict comprehension, it requires python 2.7 or 3. Could that be it?

-Gunnar

Lankipalli Mohan Babu

unread,
Feb 9, 2017, 8:17:31 AM2/9/17
to Quepy, grom...@gmail.com
PFA, Can you solve this problem ?
using windows 10 and python 3.6.
error.JPG
Reply all
Reply to author
Forward
0 new messages