You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to pass my own environment variables to the subprocess, for example to set OMP_THREAD_LIMIT. This custom value should be limited to a specific scope, as other parts of my program should not be affected by this.
Judging from the code, this is not possible for now.
The text was updated successfully, but these errors were encountered:
As you already mentioned, your approach would make this setting permanent for the whole program. I could write a context manager for temporarily changing the value, but this is quite an overhead.
For now, I settled on monkey patching the pytesseract environment, but this is just an ugly hack as well:
I guess that you want to dynamically change the environment variables.
Because for standalone usage of pytesseract, you can just use OMP_THREAD_LIMIT=1 pytesseract ...
The python docs refer to os.environ.copy() as a good way to make environment copy of the mapping.
Then you can pass your specific modified version, but monkey patching pytesseract is still required with this method.
I am not sure, but maybe os.putenv() might work for your use case.
It looks less hacky, but also looks very implicit and the support for it varies.
I would like to pass my own environment variables to the subprocess, for example to set OMP_THREAD_LIMIT. This custom value should be limited to a specific scope, as other parts of my program should not be affected by this.
Judging from the code, this is not possible for now.
The text was updated successfully, but these errors were encountered: