| | |
opening an exe from Program Files directory in windows
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
I've just done a bit of digging around on python.org and found this:
http://bugs.python.org/issue1524
Looks like I'm not the first person to come up with this workaround....See the post made by daniel.weyh on the 25th June 2008.
Jas.
http://bugs.python.org/issue1524
Looks like I'm not the first person to come up with this workaround....See the post made by daniel.weyh on the 25th June 2008.
Jas.
If you're into metal, check out my new band at:
http://www.myspace.com/kinasis
Now booking gigs for 2010....
http://www.myspace.com/kinasis
Now booking gigs for 2010....
This problem has been around for a long time and not just with Python:
python Syntax (Toggle Plain Text)
# the "Microsoft kludge", quoting a string within a string fixes the # space-in-folder-name problem, tells the OS to use the whole string # including spaces as a single command # (make sure filename does not contain any spaces!) os.system('"C:/Program Files/IrfanView/i_view32.exe" ' + filename)
drink her pretty
•
•
•
•
python Syntax (Toggle Plain Text)
os.system('"C:/Program Files/IrfanView/i_view32.exe" ' + filename)
Hang on....Looking back at my failed scripts from when I was playing around, I had the " and the ' the wrong way around! Damn these fat drummer fingers! grrr! heh heh!

Thanks for that Ene! Yes that's far better than my solution!
Cheers for now,
Jas.
If you're into metal, check out my new band at:
http://www.myspace.com/kinasis
Now booking gigs for 2010....
http://www.myspace.com/kinasis
Now booking gigs for 2010....
•
•
•
•
just thinking... wouldnt it have made more sense to just change "Program files" to "Program_files" or something similar?
Simply renaming the 'Program Files' folder to 'Program_Files' would cause most (if not all) of your programs to either malfunction, or not work at all when you tried to run them.
The OS probably wouldn't take it too well either!
Plus any shortcuts you have for any programs in the 'Program Files' folder will also stop working...(e.g. desktop shortcuts and start menu links)
So in this case...No! Changing the folder name would definitely not be the best option. Ene's line of code is by far the best solution to the problem!
Cheers for now,
Jas.
If you're into metal, check out my new band at:
http://www.myspace.com/kinasis
Now booking gigs for 2010....
http://www.myspace.com/kinasis
Now booking gigs for 2010....
•
•
Join Date: Sep 2009
Posts: 113
Reputation:
Solved Threads: 16
Its actually not as tough as people are making it out to be, if you have a space you need to put ' ' or " " around it to clarify that it has a space, maybe try this:
I may be wrong, i might have just been using Linux too long
Python Syntax (Toggle Plain Text)
import os os.system("'C:\Winamp\Winamp.exe'")
I may be wrong, i might have just been using Linux too long
![]() |
Similar Threads
- Rundll.exe error, Not respodning when closing windows XP (Viruses, Spyware and other Nasties)
- Cannot find Windows Explorer (Windows NT / 2000 / XP)
- winupdate.exe problem (Viruses, Spyware and other Nasties)
- RunTime error C++ C: \Program Files|MusicmatchJukebox\mm_tray exe (Viruses, Spyware and other Nasties)
- Internet Explorer & Windows Explorer (desktop shortcuts) Won't Load! (Viruses, Spyware and other Nasties)
- I have this c:\windows\system32\z14.exe HELP!!!!!! (Viruses, Spyware and other Nasties)
- Error loading C:\WINNT\Downloaded Program Files\bridge.dll (Viruses, Spyware and other Nasties)
- Error loading C:\WINDOWS\Downloaded Program Files\bridge.dll (Viruses, Spyware and other Nasties)
- rundll error loading C:\PROGRA~1\INTERN~3\inetkw.dll (Viruses, Spyware and other Nasties)
- "WINDOWS\ SYSTEM\ BRIDGE.DLL" (Viruses, Spyware and other Nasties)
Other Threads in the Python Forum
- Previous Thread: Text Files
- Next Thread: Cookies
Views: 1012 | Replies: 22
| Thread Tools | Search this Thread |
Tag cloud for Python
alarm aliased application beginner calculator casino character code command cursor cx-freeze definedlines development dictionary dynamic error event examples excel exe file filename float format ftp function google graphics gui homework ideas import input java launcher line linux list lists logging loop matching microphone mouse movingimageswithpygame newb number numbers obexftp output parsing path permissions phonebook port prime program programming projects py2exe pygame pygtk pyqt pysimplewizard python random recursion recursive refresh return reverse scrolledtext shebang simple skinning sprite ssh statistics string strings table terminal text thread threading time tkinter tlapse tricks tuple tutorial ubuntu unicode urllib urllib2 valueerror variable voip windows wxpython







