Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #16  
Old October 18th, 2003, 12:02 PM
shiyu shiyu is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 12 shiyu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally posted by netytan
There are two ways that i know of to do this, 1 you could us the -w flag from the command line, something like..

python setup.py py2exe -w

2, give your python program a .pyw extension (abc.py becomes abc.pyw)

Mark.


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.

Reply With Quote
  #17  
Old October 18th, 2003, 06:01 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,537 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 17 m 47 sec
Reputation Power: 68
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
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.
__________________
programming language development: www.netytan.com Hula


Reply With Quote
  #18  
Old October 19th, 2003, 12:48 AM
shiyu shiyu is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 12 shiyu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks a lot.
I tried add a -w after my command.It worked,and removed the DOS windows.

Reply With Quote
  #19  
Old October 30th, 2003, 01:59 PM
electrichead electrichead is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 5 electrichead User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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 ?

Reply With Quote
  #20  
Old October 30th, 2003, 03:33 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,537 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 17 m 47 sec
Reputation Power: 68
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
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.

Reply With Quote
  #21  
Old November 1st, 2003, 04:16 AM
electrichead electrichead is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 5 electrichead User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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 ?

Reply With Quote
  #22  
Old November 1st, 2003, 11:43 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,537 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 17 m 47 sec
Reputation Power: 68
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
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:
--includes or -i list
comma separated list of modules to include. Note that includes overrides excludes.


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.

Reply With Quote
  #23  
Old November 5th, 2003, 03:32 PM
electrichead electrichead is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 5 electrichead User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ALRIGHT ! I did that and it worked... but I wasn't expecting it to work . Thanks !

Reply With Quote
  #24  
Old November 5th, 2003, 04:45 PM
electrichead electrichead is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 5 electrichead User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #25  
Old November 5th, 2003, 06:06 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,537 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 17 m 47 sec
Reputation Power: 68
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
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.

Reply With Quote
  #26  
Old November 5th, 2003, 06:57 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,537 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 17 m 47 sec
Reputation Power: 68
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
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.

Reply With Quote
  #27  
Old November 5th, 2003, 07:06 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,537 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 17 m 47 sec
Reputation Power: 68
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
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.

Reply With Quote
  #28  
Old November 6th, 2003, 03:44 AM
electrichead electrichead is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 5 electrichead User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Great ! I tried the warnings module thing and it worked perfectly.

Many thanks !

Reply With Quote
  #29  
Old January 3rd, 2010, 03:12 PM
Chantrysackett Chantrysackett is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2010
Posts: 1 Chantrysackett User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 27 m 5 sec
Reputation Power: 0
Py2.exe to PY

I have a different problem. I converted all my code from py to exe and then my system failed and then I found out that the system I had been using for my backups also failed. The only thing I have available to me is the exe file. So my problem now is how to convert the exe file back to py in the hopes of getting my source code back. Anyone have any ideas?

Reply With Quote
  #30  
Old June 18th, 2012, 01:12 AM
partblah1990 partblah1990 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2012
Posts: 1 partblah1990 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 28 sec
Reputation Power: 0
I need help for my file , to be executable..Can anyone help me ?

<edited by Scorpions4ever>That file is a key-generator for certain Huawei routers. </edited>

Last edited by Scorpions4ever : June 18th, 2012 at 01:35 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > How to convert .py to .exe?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap