- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
My plugins are splitted into main script and dependent modules which contains commonly used code. The problem is that this prevents the plugin to be fully uninstalled because there are still __pycache__/*.pyc files inside its directory.
The first attempt was to turn off python cache at the beginning of the script:
import sys
sys.dont_write_bytecode=True
...
and turn it on again after process finish. Generally, it works on Windows 8.1 (I haven't tested on Mac) but the problem may be in a situation when user runs some other Python processes on his machine which needs *.pyc files while my plugin will try turn them off.
Another disadvantage of this way is that all scripts of the plugin must be recompiled everytime when the user runs the plugin.
Changing prefix for __pycache__ is not acceptable because it'll change global path on user's machine.
I also checked stackoverflow forum but the best suggestion from there is to make one big file by writing own consolidator or use mergers which have very specific logic. There is also something like Python Eggs or Wheel but I don't know it is supported by the Fusion.
Currently, the only option for me is writing modules as classes which let me to simply copy theirs code to main script before I sent package to the review.
Is there any possibility to remove *.pyc files after uninstalling plugin?
Solved! Go to Solution.