|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#16
|
|||
|
|||
|
Quote:
1.What does "-w" do?Can it remove the command window? 2.you mean change all .py files to .pyw?and run the command like "python setup.pyw py2exe -w? Thank you. |
|
#17
|
||||
|
||||
|
Well, pyw files run without the console window, so if you have a Python GUI (or any other Python program) with .pyw extension it will run without the "command window".. you just write a normal setup.py file and point it at your pyw
The -w flag will do exactly the same thing as the method above and works exactly the same way as normal, all you need to do is add -w to the end of your command ![]() Mark. |
|
#18
|
|||
|
|||
|
Thanks a lot.
I tried add a -w after my command.It worked,and removed the DOS windows. |
|
#19
|
|||
|
|||
|
I have a question :
When you add the '-w' flag, it means you want to run your script with pythonw.exe. I tried this for a simple script and nothing happens when I launch my program (and it works when I build a console app). Do I need to add something in my script to run this way ? |
|
#20
|
||||
|
||||
|
Running a console app with pythonw.exe wont show and console window because thats exactly what its designed to do, your program still runs as normal though! Which is great when you want to make programs which run in the background (out of sight)..
Mark. |
|
#21
|
|||
|
|||
|
Hummm... Sounds interesting. In fact it gave me an idea, but I have a problem :
When I added the pickle module to my script, I got a warning message while compiling saying that some modules could not be found (readline, carbon...). Now my script works fine before I convert it to exe but it doesn't work anymore after I've done so... What can I do ? |
|
#22
|
||||
|
||||
|
mnot sure exactly what your doing but i see no reason why it doesn't work.. you could try using one of the 'Flags to include or exclude modules or packages' on Py2exe's homepage i.e.
Quote:
looks promising, give that a go, if it doesnt work then let me know and i'll run a few tests myself! Take care, Mark. |
|
#23
|
|||
|
|||
|
ALRIGHT ! I did that and it worked... but I wasn't expecting it to work
. Thanks ! |
|
#24
|
|||
|
|||
|
Oh, I forgot... When I convert some script to exe, (leaving the console...), I get warning messages that I don't see when running my script on Python GUI (such as "Warning : integer exponentiation", and some others...) Can I remove those and if yes how ?
Thanks in advance. |
|
#25
|
||||
|
||||
|
Mmmmmm, i've never head of this before and i can't find any docs on the p2exe website about this.. since warnings are not errors you cant really use the try statment on it (or i don't think so). I'll look into turning warnings off for you though and let you know what i find!
Mark. |
|
#26
|
||||
|
||||
|
Ok, there are two ways too do this from what i can see.. the first is by using the command line option -W arg which i havn't quite figured out yet! and the second (and my prefered) way if to use the warnings module i.e. import warnings; warnings.filterwarnings('ignore')
Hope this helps, Mark. |
|
#27
|
||||
|
||||
|
Ok, i got the -W thing down - got a little comfused there for a second or two
- if your calling a Python program from the command line and you want to turn warnings off you can do something like this:python -W ignore path/to/python/program the ignore option can be changed to yeild different results depending. I know this wont help much with Py2exe but just incase anyone was interested. Mark. |
|
#28
|
|||
|
|||
|
Great ! I tried the warnings module thing and it worked perfectly.
Many thanks ! |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > How to convert .py to .exe? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|