How to do hot update in Pyd?
仅有的幸福
仅有的幸福 2017-06-13 09:24:40
0
3
1322

Now we have a plug-in update system for the PC client. In the past, the plug-in had the suffix .py. no problem. But recently there is a problem when using cython to compile pyd. When the main program imports the pyd module, it cannot be deleted. Prompt file occupation. It can only be deleted when the main program is closed. But this loses the meaning of hot update. Is there any way to dynamically uninstall pyd or is there a better way?

import xxpyd
import sys

print 'xxpyd' in sys.modules
del sys.modules['xxpyd']
print 'xxpyd' in sys.modules

import time
time.sleep(100)

Even if sys.modules is deleted, pyd cannot be deleted.

仅有的幸福
仅有的幸福

reply all(3)
Ty80

There is currently a compromise solution, which is to use a plug-in management class to control the import and acquisition of pyd. The advantage is that it can be hot updated as many times as desired. The disadvantage is that all referenced import syntax must be replaced by the plug-in management class to import

刘奇

If the imported pyd file cannot be deleted, can it be updated with a new pyd file every time, such as 20170616.pyd (just an example). Other old files will be deleted every time the main program is stopped or at other times.

给我你的怀抱

pyd is essentially dll

There is a saying called dll hell, which describes how difficult it is to do version management of dlls

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!