By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,994 Members | 1,166 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,994 IT Pros & Developers. It's quick & easy.

Batch execution problem with the executable

100+
P: 440
Hi,

I have created a Executable ( Exe) of an Python application using Py2Exe.I have implemented for Batch or Interactive application run in the source code.But I able run the interactive application when I run the executable (or) by giving the option 'gui'

Interactive:
---------------

C:\Sample\Main.exe

(or)
C:\Sample\Main.exe gui

Graphical User Interface will be displayed.

Batch:
--------
C:\Sample\Main.exe C:\Test.in

Nothing is displayed.I have given the print statement also for printing the data
print ' Batch'

Help:
-------
C:\Sample\Main.exe help

It should display the message for executing the application in Btach/Interactive.

When I run the application with *.py or *.pyc , I am able to execute both Interactive or Batch options successufly

I will post a sample snippet of the program,to understand the Batch and Interactive option execution

Thanks
PSB
Jun 6 '07 #1
Share this Question
Share on Google+
2 Replies


100+
P: 440
I have fixed this problem ,by changing the setup file
Expand|Select|Wrap|Line Numbers
  1. Setup.py
  2.  
  3. import glob
  4. import os
  5. import sys
  6. from distutils.core import setup
  7. import py2exe
  8.  
  9. def files(folder):
  10.     for path in glob.glob(folder+'/*'):
  11.         if os.path.isfile(path):
  12.             yield path
  13.  
  14. data_files=[
  15.             ('.', glob.glob(sys.prefix+'/DLLs/*.dll')), 
  16.             ('tcl/Tix8.4.2', files(sys.prefix+'/tcl/Tix8.4.2')),
  17.             ('tcl/Tix8.4.2/bitmaps', files(sys.prefix+'/tcl/Tix8.4.2/bitmaps')),
  18.             ('tcl/Tix8.4.2/pref', files(sys.prefix+'/tcl/Tix8.4.2/pref')),
  19.            ]
  20.  
  21. setup(
  22.       script_args=['py2exe'],
  23.       #windows=['C:\Test\Main.py'],
  24.       console=['C:\Test\Main.py'],
  25.       data_files=data_files,
  26.      )
  27.  
We have to change the 'winows' variable to 'console'
Jun 6 '07 #2

bartonc
Expert 5K+
P: 6,596
Thank you very much for the py2exe setup script!

The first post made this look like a question, so I have moved it from the Articles section. I will soon be compiling an article on py2exe and will be sure to include your script.

Thanks, again,
Barton
Jun 7 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.