local_import was deprecated several years ago (I don't think it's even mentioned in the book any more). Just use regular imports. There shouldn't be any need to change sys.path. If you still have problems, we may need to see some real code and names. There could be issues if your module has the same name as another in system (this isn't a problem at the top level of /modules, but can cause problems when there are submodules).
Anthony On Friday, July 20, 2018 at 7:55:20 AM UTC-4, Scott ODonnell wrote: > > I have an API Wrapper library I'm trying to use in my Web2PY project by > including it in the modules directory. > I'm copying a directory called myWrapper into the modules directory. > > The result is applications/myApp/modules/myWrapper > Within the myWrapper directory are all the files that make up the > myWrapper library > > The problem is that I need to load a class from a file within the > MyWrapper Library. > In any vanilla python script I would simply do the following > > From myWrapper.fileA import classA > > I'm not sure how/if I can do the same thing inside Web2PY using > import_local(). > > Further, I did attempt to modify the python sys.path to include the > myWrapper directory , which allowed me to use: > From myWrapper.fileA import classA > > BUT .... Within classA there are additional imports (from other files > within the myWrapper directory) that fail to import. > I get the "No module named .... " error. > > Is there a proper way to get all this working? > > Thanks in advance > Scott > > > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.