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
a source to share
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.
a source to share