
- HOW DO YOU LOAD FROM THE CLOUD ON IDLE FARMING EMPIRE FULL
- HOW DO YOU LOAD FROM THE CLOUD ON IDLE FARMING EMPIRE CODE
I found Chris' solution worked on the command line but not from inside a program. I don't pretend to understand why, but it seems to work from within a program.

This appears to use non-deprecated modules from Python 3.4. Spec = _from_file_location(module_name,full_path_to_module) Module_name, module_ext = os.path.splitext(module_file) Module_dir, module_file = os.path.split(full_path_to_module)
HOW DO YOU LOAD FROM THE CLOUD ON IDLE FARMING EMPIRE FULL
# Get module name and path from full path Import a module given the full path/filename of the. def import_module_from_file(full_path_to_module):
HOW DO YOU LOAD FROM THE CLOUD ON IDLE FARMING EMPIRE CODE
This area of Python 3.4 seems to be extremely tortuous to understand! However with a bit of hacking using the code from Chris Calloway as a start I managed to get something working. The reason for this is the fundamental invariant of the relative import system: "The invariant holding is that if you have sys.modules and sys.modules (as you would after the above import), the latter must appear as the foo attribute of the former" as discussed here. So you need to bind the name before you load it. But "mymodule" isn't loaded yet so you'll get the error "SystemError: Parent module 'mymodule' not loaded, cannot perform relative import". Without this line, when exec_module is executed, it tries to bind relative imports in your top level _init_.py to the top level module name - in this case "mymodule". Spec = _from_file_location(MODULE_NAME, MODULE_PATH)

In Python 3.5+ the following code is needed (note the added line that begins with 'sys.modules'): MODULE_PATH = "/path/to/your/module/_init_.py" If your top-level module is not a file but is packaged as a directory with _init_.py, then the accepted solution almost works, but not quite.
