win32com can't find file but I can see it, confused

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

win32com can't find file but I can see it, confused

dave selby-2
OK I am a little confused, I have the following

shell = win32com.client.Dispatch('WScript.Shell')
print os.path.isfile(self.exe)
print self.exe
shell.Run(self.exe)

The file self.exe exists, I get a 'true' from os.path.isfile, I can
execute it on the command line AOK, its path is as I would expect but
when I attempt to execute it I get ...

True
C:\Documents and Settings\dave\Desktop\My Mobile\MyMobiler\MyMobiler.exe
Traceback (most recent call last):
 File "C:\Program Files\FX Hammer\core\diag.py", line 64, in <module>
   my_mobiler_.startExe()
 File "C:\Program Files\FX Hammer\core\my_mobiler.py", line 93, in startExe
   shell.Run('C:\Documents and Settings\dave\Desktop\My
Mobile\MyMobiler\MyMobiler.exe')
 File "<COMObject WScript.Shell>", line 2, in Run
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None,
None, None, 0, -2147024894), None)

Now using win32api.FormatMessage() I get ...

Exception occurred.

The system cannot find the file specified.

Am I missing anything ?

Cheers

Dave



--

Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html



--

Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
_______________________________________________
python-win32 mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-win32
Reply | Threaded
Open this post in threaded view
|

Re: win32com can't find file but I can see it, confused

Randy Syring-2
Do you need to quote the value sent to shell.run() since there is a space in it?

shell.Run('"C:\Documents and Settings\dave\Desktop\MyMobile\MyMobiler\MyMobiler.exe"')

?
---------------------------------------------
Randy Syring
Development & Executive Director
Level 12 Technologies (formerly Intelicom)
Direct: 502-276-0459
Office: 502-212-9913

Intelicom is now Level 12 Technologies, learn more about our name change.
Please update your address book with my new email address.

Principled People, Technology that Works

On 03/09/2012 08:17 AM, dave selby wrote:
OK I am a little confused, I have the following

shell = win32com.client.Dispatch('WScript.Shell')
print os.path.isfile(self.exe)
print self.exe
shell.Run(self.exe)

The file self.exe exists, I get a 'true' from os.path.isfile, I can
execute it on the command line AOK, its path is as I would expect but
when I attempt to execute it I get ...

True
C:\Documents and Settings\dave\Desktop\My Mobile\MyMobiler\MyMobiler.exe
Traceback (most recent call last):
 File "C:\Program Files\FX Hammer\core\diag.py", line 64, in <module>
   my_mobiler_.startExe()
 File "C:\Program Files\FX Hammer\core\my_mobiler.py", line 93, in startExe
   shell.Run('C:\Documents and Settings\dave\Desktop\My
Mobile\MyMobiler\MyMobiler.exe')
 File "<COMObject WScript.Shell>", line 2, in Run
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None,
None, None, 0, -2147024894), None)

Now using win32api.FormatMessage() I get ...

Exception occurred.

The system cannot find the file specified.

Am I missing anything ?

Cheers

Dave




_______________________________________________
python-win32 mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-win32
Reply | Threaded
Open this post in threaded view
|

Re: win32com can't find file but I can see it, confused

Tim Roberts
Randy Syring wrote:
> Do you need to quote the value sent to shell.run() since there is a
> space in it?
>
> shell.Run('"C:\Documents and
> Settings\dave\Desktop\MyMobile\MyMobiler\MyMobiler.exe"')

Right.  More than that, he needs to escape the backslashes or use a raw
string, as in:

  shell.Run(r'"C:\Documents and Settings..."')

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-win32