Problem in importing python packages under python 3.6 environment

Hi All,
I have limited knowledge on python development. I am trying to write a test application which needs to import from many packages across mutliple directories.
I tried using an environment variable and appending to sys.path variable so that import Class methods works.
I am trying to replace the above logic by below syntax.
from directory.fileName import ClassName
But this syntax does not work. Please let me know any solution for this issue.

This mailing list is for the discussion of the development *of* Python, not its use. Your best bet for help is either a site like Stack Overflow or another mailing list like python-tutor or python-list.
On Thu, 9 Aug 2018 at 08:30 Poornima .D. poornimad2811@gmail.com wrote:
Hi All,
I have limited knowledge on python development. I am trying to write a test application which needs to import from many packages across mutliple directories.
I tried using an environment variable and appending to sys.path variable so that import Class methods works.
I am trying to replace the above logic by below syntax.
from directory.fileName import ClassName
But this syntax does not work. Please let me know any solution for this issue.
Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/brett%40python.org

Hello.
This mailing list is to work on developing Python (adding new features to Python itself and fixing bugs); if you're having problems learning, understanding or using Python, please find another forum. Probably python-list/comp.lang.python mailing list/news group is the best place; there are Python developers who participate in it; you may get a faster, and probably more complete, answer there. See https://www.python.org/community/ for other lists/news groups/fora. Thank you for understanding.
On Thu, Aug 09, 2018 at 06:15:49PM +0530, "Poornima .D." poornimad2811@gmail.com wrote:
Hi All,
I have limited knowledge on python development. I am trying to write a test application which needs to import from many packages across mutliple directories.
I tried using an environment variable and appending to sys.path variable so that import Class methods works.
I am trying to replace the above logic by below syntax.
from directory.fileName import ClassName
But this syntax does not work. Please let me know any solution for this issue.
Not enough information to answer. To ask such a question you'd better prepare a simple exmaple that doesn't work -- just a few small files and directories.
Learn about Python modules/packagaes at https://docs.python.org/3/tutorial/modules.html especially paying attention to The Module Search Path: https://docs.python.org/3/tutorial/modules.html#the-module-search-path
Oleg.

Hi Poornima,
Your question is more appropriate for the python-list mailing list ( https://mail.python.org/mailman/listinfo/python-list) or python-tutors mailing list (https://mail.python.org/mailman/listinfo/tutor).
On Thu, Aug 9, 2018, 8:30 AM Poornima .D. poornimad2811@gmail.com wrote:
Hi All,
I have limited knowledge on python development. I am trying to write a test application which needs to import from many packages across mutliple directories.
I tried using an environment variable and appending to sys.path variable so that import Class methods works.
I am trying to replace the above logic by below syntax.
from directory.fileName import ClassName
But this syntax does not work. Please let me know any solution for this issue.
Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/mariatta.wijaya%40gmail.c...

On 8/9/2018 8:45 AM, Poornima .D. wrote:
I have limited knowledge on python development. I am trying to write a test application which needs to import from many packages across mutliple directories.
I tried using an environment variable and appending to sys.path variable so that import Class methods works.
I am trying to replace the above logic by below syntax.
from directory.fileName import ClassName
But this syntax does not work. Please let me know any solution for this issue.
When you post elsewhere, you must supply more information: * Copy and paste a minimal example of code that fails, ideally just one line. If your example involves importing code you wrote, add the directory structure of your code. * Copy and paste the actually traceback and error message.
participants (5)
-
Brett Cannon
-
Mariatta Wijaya
-
Oleg Broytman
-
Poornima .D.
-
Terry Reedy