How do I set up a RAM disk using python or WMI?

The background of my question has to do with Tesseract, a free OCR engine (1985-1995 HP, now on Google). This requires an input file and an output file; the argument only accepts a filename (not stream / binary string), so temporary OCR files must be generated to use a wrapper API like pytesser and / or python-tesser.py. I have, however, a lot of images required for OCR; frequent disk writes and erasures are inevitable (and of course performance). The only choice I could think of would be to change the wrapper class and point a temp file to the RAM disk, which would lead to this issue.

If you have a better solution please let me know.

Many thanks.

-M

+2


a source to share


2 answers


Are you on Linux? You can try to send a file to the program through a pipe and access / dev / fd / 0 - this is the standard input path for the current process. It should work if the application is not looking () through it.



0


a source


While searching on Google, I found a possible solution (which does not include WMI, but you can use it via subprocess

):

Download the devcon utility , which is a command line device manager. Then you can use something like:



subprocess.call( ("path_to_devcon\\devcon.exe", "INSTALL", "ramdisk.inf", "ramdisk") )

      

Hope this gets you started.

0


a source







All Articles