Click here to Skip to main content
15,885,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I'm writing a script to scan documents from an Image scanner device.
I imported the pyinsane2 module and everything works fine, but I want to change the location, of where the scanned document is saved. At the moment, it saves the new document in the same directory, where the script, I'm running to scan, is stored as well. So e. g. my script
scan.py
is stored in
C:\Users\Admin\Documents\pyinsane-2.0.2\examples
so the scanned document gets stored in examples too.
The line of code in the script, that causes this loooks like this:
img = scan_session.images[0]
img.save(output_file, "JPEG")
where img is the scanning process and output_file is the name of the document.
So the question is, what to type instead of 'save' to save the document where ever I want to.
I'm running a Windows 10 Computer using python 3.6. Thanks

What I have tried:

I haven't tried anything, because I couldn't find anything to the .save function from python and I don't want to create a folder using mkdir.
Posted
Updated 26-Feb-18 14:24pm
v3
Comments
Richard Deeming 26-Feb-18 14:54pm    
Try specifying the full path in output_file, rather than just the file name.
pycoding 26-Feb-18 15:12pm    
Thanks for the comment. So output_file is defined as args, with args = E.get() (E is an entry widget in my tkinter app). Where do I define the path here ?
Richard MacCutchan 27-Feb-18 4:19am    
Write the path into the text box of the entry widget, or add it somewhere else in your code as a string.
pycoding 2-Mar-18 12:06pm    
But the users types in the name of the document into the entry widget. The saving location should always be the same, just not where the script is stored.
Karthik_Mahalingam 21-Mar-18 23:46pm    
Tip: use  Reply  button, to post Comments/query to the user, so that the user gets notified and responds to your text.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900