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

LibreOffice Python Syntax Error Mac OS X #166

Closed
aldofunes opened this issue Oct 18, 2013 · 4 comments
Closed

LibreOffice Python Syntax Error Mac OS X #166

aldofunes opened this issue Oct 18, 2013 · 4 comments

Comments

@aldofunes
Copy link

When I execute directly from the Python built within LibreOffice like this:

$ /Applications/LibreOffice.app/Contents/MacOS/python /opt/local/unoconv/unoconv

I get the following error:

File "/opt/local/unoconv/unoconv", line 241
print 'PATH=%s' % os.environ['PATH']
^
SyntaxError: invalid syntax

I am using Mac OS X 10.8.5 LibreOffice 4.1.2 and Unoconv 0.6

@aldofunes
Copy link
Author

By the way, the Python version in LibreOffice 4.1.2 is 3.3.0

I think it may be a compatibility issue. Do you know where can I get an older LibreOffice version that works with Unoconv?

@candlerb
Copy link

I get the same. The script is rejected when run directly by the Mac's python interpreter:

Brians-MacBook-Air:unoconv-0.6 $ python -V
Python 2.7.1
Brians-MacBook-Air:unoconv-0.6 $ python unoconv
  File "unoconv", line 241
    print 'PATH=%s' % os.environ['PATH']
                  ^
SyntaxError: invalid syntax

But something bizarre is going on, it parses fine if I disable the __name__=="__main__" test (but of course doesn't run).

@candlerb
Copy link

OK, it does seem to be an issue of the code somehow ending up running under python3.

I was able to convert it using 2to3 -w unoconv, and also adding at the top

from __future__ import print_function

so that it runs under python2 as well.

@xrmx
Copy link
Contributor

xrmx commented Dec 29, 2013

@aldofunes You have to use unoconv from git and not 0.6, it has already been fixed

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

No branches or pull requests

4 participants