[Tutor] Questions about easygui and compiling

Gordon chaosweevil42 at gmail.com
Fri Jun 8 23:21:29 CEST 2007


Yes, I can.  But first, make sure to hit"Reply All" to send replies to 
the list, rather than just me :)

Anyhow, there are a couple ways, but I think the easiest is to make a 
one-line script that imports the file you want to make a .pyc out of.  
You'll end up with 3 versions of the file, a .py, a .pyc, and a .pyo.  
You can then take the .pyc and run it in any compatible Python interpreter.

There are ways to make multiple files into .pyc all at once with the 
"compileall" module, which you can find more about at in the Python 
documentation.

Rafael Bejarano wrote:
> That is helpful. Thank you.
>
> Can you tell me how to convert a script to a .pyc file?
>
> Rafael
> On Jun 8, 2007, at 1:49 AM, Gordon wrote:
>
>> I have no experience with EasyGUI, but to answer your other question, 
>> you do not "compile" Python in the way you compile C or Java.
>>
>> Python can be compiled into a .pyc file, which is slightly faster to 
>> start running and obfuscates the source, but it doesn't really do 
>> much, practically.  You can also use Py2EXE or PyInstaller to make 
>> standalone executables for Windows.
>>
>> Simply running a script through the Python interpreter is as far as 
>> you can get for now, although there is a project, name "Psycho", 
>> which translates Python to x86 Assembly, though it is only available 
>> for Windows and Linux, and doesn't always speed things up.
>>
>> Hope that helps!
>>
>> Rafael Bejarano wrote:
>>> Hello,
>>>
>>> I am very new to python and have a couple of questions, to which I  
>>> would very much appreciate answers from the members of this list.
>>>
>>> First, I am trying to learn to use easygui to present simple 
>>> dialogs  and get input from the user. To this end, I wrote a very 
>>> short test  program, just to make sure I new how to use easygui. 
>>> Although I get  no error messages when I run it, the dialog boxes do 
>>> not appear. What  might I be doing wrong? It may be helpful to know 
>>> (a) that I am  learning python on a Mac iBook g4 (running OS 10.4), 
>>> (b) that I wrote  the test program using the Smultron text editor, 
>>> and (c) that I am  using python launcher to run the program. I would 
>>> be only too happy  to send a copy of the program as an attachment or 
>>> pasted in the body  of a future e-mail message, should someone on 
>>> this list feel that  doing so would be helpful in answering my 
>>> question.
>>>
>>> Second, how does one compile python programs?
>>>
>>> Cordially,
>>> Rafael Bejarano
>>> _______________________________________________
>>> Tutor maillist  -  Tutor at python.org
>>> http://mail.python.org/mailman/listinfo/tutor
>>>
>>>
>
>



More information about the Tutor mailing list