471,350 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

win32com ppt saveas, not allowing spaces?

Hey all,

As always, thanks in advance!
I am trying to save a ppt presentation but am having problems regarding spaces and am wondering
if I am doing something wrong or whether this is a bug? Also, is there a way around this other
than not using spaces in paths or filenames? I can create filesnames without spaces but don't have
much control over paths.

WB.SaveAs("C:/temp/00_FINAL." + time.strftime("%Y.%m.%d.(%I.%M.%S%p)", time.localtime()) + ".ppt")

saves the file C:\temp\00_FINAL.2007.07.16.(09.43.50AM).ppt

WB.SaveAs("C:/tmp dir/00_FINAL." + time.strftime("%Y.%m.%d.(%I.%M.%S%p)", time.localtime()) + ".ppt")

gives the error:

Traceback (most recent call last):
File "C:\temp\ppt.py", line 412, in ?
WB.SaveAs("C:/tmp dir/00_FINAL." + time.strftime("%Y.%m.%d.(%I.%M.%S%p)", time.localtime()) + ".ppt")
File "C:\Program Files\Python\lib\site-packages\win32com\gen_py\91493440-5A91-11CF-8700-00AA0060263Bx0x2x8.py", line 6827, in SaveAs
return self._oleobj_.InvokeTypes(2036, LCID, 1, (24, 0), ((8, 1), (3, 49), (3, 49)),FileName, FileFormat, EmbedTrueTypeFonts)
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft Office PowerPoint 2003', 'Presentation.SaveAs : The path or file name for C://tmp%20dir/00_FINAL.2007.07.16.(09.44.01AM).ppt is invalid. Please check that the path and file
name are correct.', '', 0, -2147467259), None)

Tool completed with exit code 1


WB.SaveAs("C:/temp/00 FINAL." + time.strftime("%Y.%m.%d.(%I.%M.%S%p)", time.localtime()) + ".ppt")



Jul 16 '07 #1
2 3704
En Mon, 16 Jul 2007 14:47:30 -0300, Ahmed, Shakir <sh*****@sfwmd.gov>
2. But problem is that I can't copy over if the same updated
personal geodatabase to the working location, if users uses that same
geodatabase through CITRIX - ArcGIS ( user does not have permission to
edit the data)
If you get an "Access denied" (or "File is in use by another process")
error, I'm afraid there is nothing you can do from Python. Tell the users
to close the application that holds the file open and try again.
import shutil
import os

src = "c:\mydata\test\mygeo.mdb"
dst = "v:\updated\data\mygeo.mdb"
Here you have another problem: \t inside a string means the TAB character.
You have to escape all backslashes or use a raw string:
that is, either use "c:\\mydata\\test\\mygeo.mdb" or
Gabriel Genellina

Jul 16 '07 #2
import shutil
import os

src = "c:\mydata\test\mygeo.mdb"
dst = "v:\updated\data\mygeo.mdb"


This should totally work, do it all the time, but no one can be
connected to the database, ie have ArcMap or ArcCatalog open at the
time of copy, or the .ldb lock will kill it. I do all of my copies in
the early AM.
Jul 23 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Sibylle Koczian | last post: by
2 posts views Thread by floris.vannee | last post: by
5 posts views Thread by kbperry | last post: by
2 posts views Thread by Ray | last post: by
reply views Thread by Reedick, Andrew | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.