[python-win32] error message after many win32pipe.popen calls
Bill Burns
billburns at pennswoods.net
Tue Nov 15 12:45:52 CET 2005
[Jürgen wrote]
> Hi all,
>
> currently I'm testing a scipt which converts many (>500) ps files to
> pdf. I use ghostscript and the conversion is done by win32pipe.popen(
> ps2pdf.bat inputfile outputfile). I got the following error message, but
> it seems that all files were correctly converted:
>
> Traceback (most recent call last):
> File
> "C:\Python24\Lib\site-packages\pythonwin\pywin\framework\editor\document.py",
> line 301, in Run
> win32api.PostMessage(self.hwnd, MSG_CHECK_EXTERNAL_FILE, 0, 0)
> pywintypes.error: (1816, 'PostMessage', 'Nicht gen\xfcgend Quoten
> verf\xfcgbar, um diesen Befehl zu verarbeiten.')
> win32ui: Run() virtual handler (<bound method FileWatchingThread.Run of
> <pywin.framework.editor.document.FileWatchingThread instance at
> 0x06A45878>>) raised an exception
>
> Is there a way to avoid this error ? (win2k, py2.4.1, pywin205)
>
Hi Jürgen,
Achtung - The following does not address your win32pipe.open() problem,
but you can continue to read it if you want to :-)
I routinely convert many ps files myself and I use something like this:
<CODE>
import os
def convert2pdf(directory):
os.chdir(directory)
for f in os.listdir('.'):
if f.endswith('.ps'):
path, filename = os.path.split(f)
name, ext = os.path.splitext(f)
newName = os.path.join(path, name + ".pdf")
command = 'ps2pdf "%s" "%s"' % (filename, newName)
os.popen(command)
if __name__ == '__main__':
convert2pdf(r'C:\ps_files')
</CODE>
The above just uses os.popen(). I've converted thousands of ps files
with no problems at all.
My specs are:
Windows 2000 Pro SP4
Python 2.4.1
GPL GhostScript 8.15
HTH,
Bill
More information about the Python-win32
mailing list