Can I have scripts outside my python exe?
I'm new to Python and starting to learn it. However I have one query, which I'd like to know for the future.
Onc开发者_StackOverflow社区e I've made a python program and produced an exe via py2exe, is it then possible to execute python scripts outside of the exe or do I have to look at plugins?
Yes, it is entirely possible. It's a standard Python interpreter. You'll need to put the directory in sys.path
so that the filesystem importer will pick it up. And then for runtime imports generally using the __import__
function will be the easiest way.
A Google search for "py2exe runtime import" provides early in the results one example of it: http://www.velocityreviews.com/forums/t330613-py2exe-excluding-a-module-and-import-it-during-runtime-how.html
精彩评论