Hello Matt 2018-04-08 19:26 GMT+02:00 Matt Wilkie <map...@gmail.com>:
> Hi All, > > I found 3 related functions that purport to do variants of: > > Try to import a module as Python's import command does. >> >> moduleName is the module's name, without file extension. >> >> This function first attempts to import from sys.modules, >> then from the extensions and external directories. >> > > but I haven't been able to get them to work. Is it them or me? ;-) > > import leo.core.leoGlobals as g > # g.importFromPath('semantic_version', > # > r'C:\Users\mattw\Documents\GitHub\leo-editor\leo\extensions\semantic_version', > > # verbose=True) > # g.importExtension('semantic_version', verbose=True) > > g.importModule('semantic_version') > > Result: > > >python xx-test-semver.py > Traceback (most recent call last): > File "xx-test-semver.py", line 13, in <module> > g.importModule('semantic_version') > File "C:\Users\mattw\code\leo-editor\leo\core\leoGlobals.py", line 4916, > in importModule > trace = (False or g.app.trace_plugins) and not g.unitTesting > AttributeError: 'NoneType' object has no attribute 'trace_plugins' > I created a node <Log> # Node Header: @file ~/test_sem_version.py # Node Body: import leo.core.leoGlobals as g g.importModule('semantic_version') </Log> in the workbook.leo outline in the virtual environment (VE) for/of my cloned Leo-Master-Repo. The result I get, when I execute this file is: <Log> (leo-devel-git) PS C:\Users\Viktor> python ./test_sem_version.py Traceback (most recent call last): File "./test_sem_version.py", line 3, in <module> import leo.core.leoGlobals as g ModuleNotFoundError: No module named 'leo' (leo-devel-git) PS C:\Users\Viktor> v </Log> I hope this input does helps you a bit further in your investigations ... With kind regards, VR -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To post to this group, send email to leo-editor@googlegroups.com. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.