VerifiableRobotics / LTLMoP

A toolkit for designing and implementing LTL-based task specifications.
http://ltlmop.github.io
GNU General Public License v3.0
56 stars 69 forks source link

Problem with python install script on windows 7 #50

Closed houseofwealth closed 11 years ago

houseofwealth commented 11 years ago

I am using Python 2.7.3 and I get the following error with the setup script


C:\Projects\LTLMoP\dist>py setup.py Trying to use Git Bash... Found Git Bash at C:\ProgramFiles\Git\bin\bash.exe Welcome to Git (version 1.8.0-preview20121022)

Run 'git help git' to display the help index. Run 'git help ' to display help for specific commands. File "C:\Projects\LTLMoP\dist\setup.py", line 29 print "-> Running command '{} {}'...".format(program, " ".join(args)) ^

SyntaxError: invalid syntax

(error marker is pointing at the " just before .format)

cfinucane commented 11 years ago

Wow, that stumped me for a while, but here's my best guess: you have Python 2.6 also installed.

Since the setup script runs a lot of shell commands, to simplify Unix/Windows compatibility issues it makes sure it is executing inside a Git Bash terminal on Windows. If it detects that it's not inside Git Bash when first started, it searches your computer for Git Bash, opens it up, and runs python setup.py inside that new terminal. (see https://github.com/LTLMoP/LTLMoP/blob/development/dist/gitUtils.py#L40)

I see that you have some sort of alias for py to point to Python, but for some reason (paths?) when the setup script tries to run python it gets a 2.6 interpreter, which doesn't understand {} (cf. http://docs.python.org/2/library/string.html#format-string-syntax: "Changed in version 2.7: The positional argument specifiers can be omitted, so '{} {}' is equivalent to '{0} {1}'.")

You can probably force the setup script to run by calling it from inside Git Bash instead of a Windows command prompt, but you will have similar problems later as LTLMoP kicks off new Python processes in several places. Perhaps consider either removing 2.6 or renaming it to python26 so python can point to 2.7?

This is just a best guess because I do not have access to your system, but I hope it helps.

houseofwealth commented 11 years ago

Thanks for your reply. However, from what i can tell I am running 2.7.x.:


C:\Projects\LTLMoP\dist>py --version Python 2.7.3


Also py is not my alias but a utility supplied by the Python foundation for Windows to decide which version of python to call when you have both 2.7.x and 3.3.x installed on your machine. Just to be sure i explicitly call it but i get the same error as above:


C:\Projects\LTLMoP\dist>C:\ProgramFiles\Python2.7\python setup.py Trying to use Git Bash...

...

cfinucane commented 11 years ago

Okay, here are a few things to try:

  1. Does it behave any differently if you run it from inside Git Bash instead of a Windows command prompt?
  2. If you were to comment out that offending line does everything magically work?
  3. If you run a plain python --version, what is the output?

The only other thing I could think of is some sort of weird file encoding problem, but I am not sure how to diagnose that on Windows...

cfinucane commented 11 years ago

(Also, now that you mention that you have 3.x installed, I think the syntax error fits what 3.x would throw if you left out parentheses on a print statement, rather than that 2.6 format string explanation I made above.)

cfinucane commented 11 years ago

This should be fixed as of 27b3000c7332d280045b35d841b9eaf155512551. Please try the latest version and let me know if it works for you.

houseofwealth commented 11 years ago

Yes, that did the trick. Thanks!