If you replace "os.system" with "os.startfile" in the last line of your
example, is the result different?
On 4/12/06, pyt...@li... <
pyt...@li...> wrote:
>
> Message: 1
> From: Phil Edwards <ph...@li...>
> To: pyt...@li...
> Date: Wed, 12 Apr 2006 14:17:29 +0100
> Subject: [Pythoncard-users] Not enjoying win32 programming...
>
> Hi All:
>
> Coming from a Linux background, I'm struggling to understand some of the
> things that appear to be going on behind the scenes when I'm coding stuff
> to
> run under Windows XP.
>
> The application in question has a textfield containing the name of a
> Python
> source code file and an 'Edit...' button next to it. When I click the
> button,
> I'm running this code:
>
> def on_mainScriptEditBtn_mouseClick(self, event):
> editor =3D self.cfg.get('ConfigData', 'codeeditor')
> item =3D self.pathJoin(self.components.mainScript.text)
> item =3D os.path.join(self.components.baseDir.text, item)
> item =3D os.path.join(self.cfg.get('ConfigData', 'projects'), item=
)
> if sys.platform.startswith('win'):
> editor =3D GetShortPathName(editor)
> item =3D GetShortPathName(item)
> print editor + ' ' + item
> os.system(editor + ' ' + item)
>
> When the code runs, it prints out what I'm expecting, namely that I'm
> trying
> to run the Pythoncard code editor with the name of a script file as the
> only
> parameter on the command line. I then get the standard 'windows cannot
> open
> this file' dialog box and I get to tell Windows that I want codeEditor.py=
to
> be opened using the program called 'python'. The codeEditor duly opens up=
,
> but it seems as though Windows is somehow losing my command line paramete=
r
> and all I end up with is a blank codeEditor window, instead of it opening
> the
> file I wanted it to. Adding a simple 'print sys.argv' to the top of the
> codeEditor proves that this is the case.
>
> Could somebody please explain to a dumb UNIX user what vital piece of
> information I'm missing in order to make this work?
>
|