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

SyntaxError: invalid syntax (related to literal string) #37

Open
reikred opened this issue Apr 9, 2017 · 6 comments
Open

SyntaxError: invalid syntax (related to literal string) #37

reikred opened this issue Apr 9, 2017 · 6 comments

Comments

@reikred
Copy link

reikred commented Apr 9, 2017

When I run xmltable2csv I get the following error message"

File "/usr/lib/python3.4/site-packages/xmlutils/console.py", line 20
"""
^
SyntaxError: invalid syntax

The offending code is the triple-double quoted string literal as follows

def run_xml2sql():
print """xml2sql by Kailash Nadh (http://nadh.in)
--help for help

"""

What am I doing wrong here? My python is version 3.4, as you can see. I feel I must be making some basic compatibility mistake or some such, as this can not possibly be a real syntax errror, can it?

@ChillarAnand
Copy link

@reikred Thank you for bug report. Unfortunately, xmltuils is not yet compatible with Python 3. You should be able to use it with Python 2.6 or 2.7.

@reikred
Copy link
Author

reikred commented Apr 9, 2017

I see. Yes, that is the problem, and it must be a common one. Should the python version not be checked when installing?

I did some web search and found a construct that supposedly should be included in setup.py, but on my system it was not recognized and caused an error. What I tried was the syntax
python_requires='>=2.6,<=2.7',

The package maintainers may perhaps know better how to do this?

Reference: http://stackoverflow.com/a/40300957/3854366
http://setuptools.readthedocs.io/en/latest/setuptools.html?highlight=python_requires#new-and-changed-setup-keywords

@ankpotter
Copy link

If the issue lies with print statements only then you can change the format and it should run fine.
Eg - Change print """etc random information
"""
to
print("""etc random information
""")

This will take care of the print statement related issues. Also, can anyone tell me what other issues are there with the code that makes it incompatible with Python3.

@ChillarAnand
Copy link

I guess changing print statements and iterators should do. You can pass codebase through 2to3 tool and it will take care of all this basic changes.

@knadh
Copy link
Owner

knadh commented Jan 3, 2018

11da2f8 This should address the print() issue.

@reikred
Copy link
Author

reikred commented Jan 5, 2018 via email

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

4 participants