Py2Exe and sys.argv : The Lost Arguments

Thomas W thomas.weholt at gmail.com
Thu Aug 17 15:42:46 EDT 2006


I've created a simple script like so :

import sys
import wx

app = wx.PySimpleApp()
dlg = wx.MessageDialog(None, "%s" % sys.argv, 'A Message Box',
wx.YES_NO | wx.ICON_QUESTION)
retCode = dlg.ShowModal()
app.MainLoop()

If I run this on the command line like
python testcmd.py <path-to>/somefile.ext <path-to>/anotherfile.ext

it displays a messagebox with a stringformatted list containing
testcmd.py, somefile.ext and anotherfile.ext.

Then I "compile" the script using py2exe, generate a file called
testcmd.exe and select the same two files in Explorer, right click,
"Open with ...", browse to testcmd.exe and proceed. Now the dialogbox
only shows two items in the list; testcmd.exe and one of the files I
selected. Why?

Is it impossible to compile a script using py2exe and pass selected
items in Explorer to my script? It works fine when called on the
command line so it might be something related to Explorer but I'm
completly lost.




More information about the Python-list mailing list