[Tutor] sub-modules and python3

Mats Wichmann mats at wichmann.us
Wed May 31 13:45:19 EDT 2017


On 05/31/2017 11:22 AM, john wrote:
> Hi folks,
> 
> In the past I used a simple "import filename" for sub-modules in python
> 2.  With python 3 I have run into errors reported (file not found) using
> python 2 import statements.  But I'm not asking how to correct the
> import as I am able to change the way I write the import as a work
> around - but I'm importing all the files at once.  What I want to know
> is what is the best practice for my situation.
> 
> Is there a simple way using python 3  to emulate python 2 imports?
> 
> Is there a standard python 3 import tool for sub-modules (files)?
> 
> Is it acceptable to add/change the os path to allow my app to find the
> modules/files?
> 
> Any help or thoughts on the matter is welcome.

try running the 2to3 tool and see what it suggests - I know it's
supposed to know what changes should be made to imports.  You don't have
to accept its' suggestions, of course.




More information about the Tutor mailing list