473,378 Members | 1,617 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 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 4095
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.