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

win32 - associate .pyw with a file extension...

P: n/a
Hello!

I'm trying to associate a file extension to my wxPython script so that
all I have to do is double click on the file and my python script will
load up with the path of that file.

For instance, I've associated all .py files to be opened up with
emacs.exe. If I double click on a .py file, emacs.exe would open up
with that file in its buffer.

Is there a way to do this with a non-exe (wxPython script)? Everytime
I try to associate a certain file extension (right clicking file->Open
with->Choose program) with my python script (.pyw) windows states that
I do not have a valid win32 program. Is there a way to do this with a
python script? Thank you for your time.

Aug 22 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
kn********@gmail.com wrote:
Hello!

I'm trying to associate a file extension to my wxPython script so that
all I have to do is double click on the file and my python script will
load up with the path of that file.

For instance, I've associated all .py files to be opened up with
emacs.exe. If I double click on a .py file, emacs.exe would open up
with that file in its buffer.

Is there a way to do this with a non-exe (wxPython script)? Everytime
I try to associate a certain file extension (right clicking file->Open
with->Choose program) with my python script (.pyw) windows states that
I do not have a valid win32 program. Is there a way to do this with a
python script? Thank you for your time.

As long as I can see, you are trying to associate your .pyw extension
directly with your python script, let say "MyProgram.pyw". This cannot work
because Windows does not know how to run MyProgram.pyw itself. You have to
associate the .pyw extension with the python interpreter. The name of your
script has to be passed to python on the command line (together with its
command line parameter). That is, Windows has to be requested to executed
this command line:

c:/.../python_directory/python.exe MyProgram.pyw FirstParam SecondParam

Most likely, you are trying to execute this, instead:

c:/.../MyPrograDir/MyProgram.pyw FirstParam SecondParam

HTH

-----------------------------------
Alessandro Bottoni
Aug 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.