472,983 Members | 2,235 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,983 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.

Lance
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
but

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

Also,

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

yields:

C:/temp/00%20FINAL.2007.07.16.(09.45.35AM).ppt

Lance
Jul 16 '07 #1
2 4031
En Mon, 16 Jul 2007 14:47:30 -0300, Ahmed, Shakir <sh*****@sfwmd.gov>
escribió:
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
r"c:\mydata\test\mygeo.mdb"
--
Gabriel Genellina

Jul 16 '07 #2
import shutil
import os

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

shutil.copyfile(src,dst)

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Sibylle Koczian | last post by:
Hello, I've installed Python 2.4 and the win32 extensions, using administrator rights, under Windows XP in "C:\Programme". As this is a directory without spaces I didn't expect any problems. But...
2
by: floris.vannee | last post by:
Hi, Is it possible to create a com server in python and then access that server using VB .NET, for example using the following code. A very basic com server i found in a tutorial about win32com:...
5
by: kbperry | last post by:
On my machine, this runs fine, but when I try to run it on someone elses machine it blows up with an attribute error: <code> import win32com.client, pythoncom ...
2
by: Ray | last post by:
Hi, I need to use cell's background color. when I record a macro from excel, it shows: Rows("7:7").Select With Selection.Interior .ColorIndex = 8 .Pattern = xlSolid
3
by: Chris | last post by:
I'm trying to create an excel file which will act as a log, however I want to overwrite the file if it exists. Looking at the SaveAs method I can't find anything that would allow it. I don't...
4
by: rc | last post by:
I'm trying to convert VB code that registers COM+ components to Python. However, I'm unable to set values on COMAdminCatalogObject using the Value() method, it seems to think I'm trying to call the...
1
by: SPJ | last post by:
Sorry, forgot to mention Subject in my earlier post, hence reposting. ------------ I am writing a script which need's to convert an excel file to csv (text) format. For that I am using the...
0
by: Reedick, Andrew | last post by:
Word Object Model: http://msdn.microsoft.com/en-us/library/bb244515.aspx Specifically look at Document's SaveAs method. ***** The information transmitted is intended only for the person...
0
by: Tim Golden | last post by:
Lave wrote: You have broadly two approaches here, both involving automating Word (ie using the COM object model it exposes, referred to in another post in this thread). 1) Use the COM model...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.