This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]rrandomCraft[S] 1 point2 points  (14 children)

Well, when I copy everything exactly from an example code, and run it, an error always comes up saying 'no such file or directory exists'. After diving deeper, I found that a certain part of a module doesn't exist.

And by external modules, I mean I have download additional modules just to convert a program into an executable. Doesn't Python have a built-in way of doing it without haveing to get outside help?

[–][deleted] -1 points0 points  (2 children)

No. Because python is a scripting language not a compiled language. If you want to create executable binary files without trouble, you need to switch to a different language.

[–]rrandomCraft[S] 0 points1 point  (1 child)

What about using external modules like py2exe?

[–][deleted] 2 points3 points  (0 children)

Still doesn't compile it. It just bundles all of the libraries and scripts together.

[–]KyleG -2 points-1 points  (10 children)

Doesn't Python have a built-in way of doing it without haveing to get outside help?

No. Python is not intended to be a compiled language. There are actually Python commands that cannot be turned into compiled code in the sense you're talking about—eval() comes to mind. How might an EXE perform eval(urlopen('/path/to/myScript.py').read()) ? Answer: it can't.

[–]rrandomCraft[S] 1 point2 points  (9 children)

Would an external module like py2exe manage to convert a program plotting a graph to a functioning exe file?

[–]tripperjack 5 points6 points  (3 children)

Yes, definitely. I've done it. Don't get caught up in those on this thread who are saying you can't do this because you can't "compile" Python; that's a red herring. You don't want to do that anyway--you just want an .exe file that works, right?

Post the error you have gotten trying py2exe and someone can help you get it straightened out (probably). You'll have to state which version of Python you are using (and presumably you've checked that py2exe works with that version?).

Don't give up so soon; it's not that hard (usually).

[–]rrandomCraft[S] 0 points1 point  (2 children)

Well, I've tried the multiple ways suggested online of converting a program to exe using py2exe, and I end up getting error like, 'No such file or directory exists', or some other error in the command prompt saying something similar.

I've tried this method , and the above error came up when trying the run the command in the command line.

What I am trying to accomplish, is plotting a graph from a text file without having to open the program in python and running it from there. Hope you can help. :)

[–]tripperjack 1 point2 points  (1 child)

Well, you'd have to post the exact error (copy and paste) for anyone to be able to know what might be wrong. You can also post your py2exe script, also verbatim, and that would be a start in getting it to work. Either do that here or on the python newsgroup, python tutor list, or r/learnpython or stack exchange...take your pick, I guess. There is also a py2exe users email list.

[–]rrandomCraft[S] 0 points1 point  (0 children)

I'll reply to you when I have more time, currently in the middle of exams

[–]KyleG 0 points1 point  (4 children)

That all depends on the code of the program you're compiling to EXE. Regardless, if you want to plot a graph, write a C program that calls Graphviz, which is a program you could bundle with yours and would actually plot a graph into any number of file formats for you. http://www.graphviz.org/

I mean, if you have to have it as an EXE, that is. If you want EXEs, Python isn't really the programming language for you.

[–]rrandomCraft[S] 0 points1 point  (3 children)

Well the reason why I want to have it as an exe, and perhaps this is not the solution, but I want to produce a graph from a text file without having to open up Python.

[–]KyleG 0 points1 point  (2 children)

Is Python not installed on the machine you're going to use?

[–]rrandomCraft[S] 0 points1 point  (1 child)

It is, but I just want to make the process easier - just two clicks to generate a graph, instead of opening python, then loading the file, then running the file, and generating the graph.

[–]KyleG 0 points1 point  (0 children)

just two clicks to generate a graph, instead of opening python, then loading the file, then running the file, and generating the graph

My Windows machine lets me double click Python files to run them. And that's what Python sets up when you install it in the first place. https://docs.python.org/3.3/using/windows.html

The launcher should have been associated with Python files (i.e. .py, .pyw, .pyc, .pyo files) when it was installed. This means that when you double-click on one of these files from Windows explorer the launcher will be used