3

A Python application (having a permission to be executed by the user) doesn't start with double click on it. If I run it (directly, by ./theapp.pyw) in terminal I get ": No such file or directory" error (while there is no such a string in the application code and the file surely exists (renaming it and using a different name results in the same)).

But If I explicitly open it with Python (by issuing python ./theapp.pyw or right-clicking and choosing to open with Python 2.7) it works just fine.

The first line of the file says

#!/usr/bin/env python

Issuing "/usr/bin/env python" command launches Python 2.7 console.

The OS is XUbuntu Linux 11.10. The only Python installed is Ubuntu's default 2.7.

Any ideas?

2
  • Dumb question perhaps, but what are the permissions? Commented Dec 17, 2011 at 21:51
  • See the first sentence, @nate, in the parentheses. Commented Dec 17, 2011 at 21:54

1 Answer 1

3

pyw files are for windows http://filext.com/file-extension/PYW

And in windows the shebang line is ignored. Just work with the .py script.

You can also try creating a bash script that launches your python scripts with the specific flags that you want.

Sign up to request clarification or add additional context in comments.

1 Comment

dos2unix ./theapp.pyw solved the problem which seemed to be indeed in CR+LF line endings. I've mistakenly thought that .pyw extension was just meaning a GUI application (as opposed to a console script).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.