1

I have written 1 python script that is working fine. but when I create executable file by cx_freeze and click on executable file in Linux. It is not showing output window. it is not giving any error in log file.

Any one tell me how to solve this problem. how can i see at-least error from executable file.

in top of the script file i have written #!/usr/bin/env python also.

Ashish Jain
  • 720
  • 1
  • 7
  • 23
  • What distribution of linux are you using? Ubuntu? – PlasmaPower Mar 02 '14 at 17:44
  • 4
    try running your code at the terminal. Like so: `python myprogram.py`.That should give you the appropriate error messages you want. Also the problem might be with your code itself. You should post it. If it's professional work you'd rather not disclose, then write another makeshift program as similar to the original as possible – Guy Mar 02 '14 at 17:55
  • yes i m using Ubuntu and i run on terminal also, there it is running fine. only this executable file is not running – Ashish Jain Mar 02 '14 at 18:22
  • cross posted at http://superuser.com/questions/723678/linux-executable-file-is-not-working-but-script-is-working-in-python – devnull Mar 02 '14 at 20:11

1 Answers1

-2

When you click on an executable, there are two attributes which are important.

  • the file has to be executable by the user
  • the file type has to be recognized as executable

File permissions in Linux are in the form:

<owner><group><everyone>

To execute a file, it must be r-x by the user to have the privileges.

The kind of executable file is also needed. This is declared by the file extension. Also, with script files in Linux you can declare the kind of file this is on the first line of the file.

Your declaration was:

#!/usr/bin/env python

This is not correct, it should point to the executable you want to use to compile and execute the code. #!/usr/bin/python would be the correct declaration.

Daniel Andersson
  • 1,466
  • 1
  • 13
  • 22
user2691041
  • 145
  • 1
  • 4
    `#!/usr/bin/env python` is fine on *nix-like systems; it is even the recommended way [in the Python documentation](http://docs.python.org/2/tutorial/interpreter.html#executable-python-scripts). – Daniel Andersson Mar 02 '14 at 20:36
  • 2
    See also [Why do people write #!/usr/bin/env python on the first line of a Python script?](http://stackoverflow.com/q/2429511/445621) and [Why is '#!/usr/bin/env python' supposedly more correct than just '#!/usr/bin/python'?](http://stackoverflow.com/q/1352922/445621) – Daniel Andersson Mar 02 '14 at 20:42
  • Use `pyinstaller` for creating executable files for python. It is the best one to create executable files for linux and windows. – Smack Alpha Jun 01 '19 at 11:14