Problems converting files from pnm to pdf

Jay Ridgley jridgley2 at austin.rr.com
Sat Oct 10 21:02:18 UTC 2009


Folks,

I am attempting to convert some files I scanned in using Xsane from the 
.pnm file created as a result to a .pdf file so that I can send it to 
someone in a readable fashion.

I discovered a script in python that is supposed to do the trick...

However when I attempt to use it I get the error "Cannot Convert ".

The directory is owned by me with mode of 755 and has mode 640 for each 
of the files.

Can some one shed some light on how I might go about correcting the 
problem. The Python script is included below:

convert_pnm_to_pdf.py contains...

import Image
import os
import sys

filename = sys.argv[1]
try:
     newfilename = os.path.splitext(filename)[0] + ".pdf"
     Image.open(filename).save(newfilename)
     print "Converted " + newfilename
except IOError:
     print "Cannot convert " + newfilename


... end of script

Thanks,
Jay
-- 


Jay Ridgley
jridgley2 at austin.rr.com
Registered Linux User ID - 9115
Registered Ubuntu User ID - 23320




More information about the ubuntu-users mailing list