On May 14, 2010, at 11:27 AM, Iceberg wrote:
> Turns out that the fix [1] is not completed. Most apps work when using
> "web2py -f another_web2py_folder", but not those contains
> local_import('my_module', app='my_app').
>
> Should be easy to fix, but I even tried to add following lines at line
> 706 of gluon/widget.py, yet have no luck.
> sys.path.append(options.folder)
> sys.path.append(os.path.join(options.folder,'applications'))
>
> What can I do?
>
> [1]
> http://code.google.com/p/web2py/source/detail?r=52c0b092adef8a96f1f18c84e5681d4548acd9ae
Suggestion.
path = os.path.normpath(path)
if path not in sys.path: sys.path.insert(0, path)
Two things: normalizing the path is a good idea, and using insert instead of
append means that the new path will override what's in the old one.