Re: Import module from file path

2018-12-05 Thread Thomas Jollans
On 05/12/2018 02:30, Oscar Benjamin wrote: > Hi all, > > I'm looking to import a module given a string representing the path to > the .py file defining the module. For example given this setup > > mkdir -p a/b/c > touch a/__init__.py > touch a/b/__init__.py > touch a/b/c/__init__.py > touch a/b/c

Re: Import module from file path

2018-12-05 Thread Oscar Benjamin
On Wed, 5 Dec 2018 at 07:57, Peter Otten <__pete...@web.de> wrote: > > Oscar Benjamin wrote: > > > > I'm looking to import a module given a string representing the path to > > the .py file defining the module. > > I am not aware of a clean way. I have used > > def guess_modulename(filename): >

Re: Import module from file path

2018-12-04 Thread Peter Otten
Oscar Benjamin wrote: > Hi all, > > I'm looking to import a module given a string representing the path to > the .py file defining the module. For example given this setup > > mkdir -p a/b/c > touch a/__init__.py > touch a/b/__init__.py > touch a/b/c/__init__.py > touch a/b/c/stuff.py > > I hav