Category : pythonpath

I tried to append multiple sys.path. But It doesn’t work what I expect. sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) from bs import BS # <<== in os.path.dirname(os.path.abspath(os.path.dirname(__file__))) sys.path.append(os.environ.get("TOOLS")) import si # <<== in os.environ.get("TOOLS") above one is working properly but sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) sys.path.append(os.environ.get("TOOLS")) from bs import BS import si this one show error: ImportError: No module named ‘si’ I don’t why ..

Read more

My program was failing to import modules, even though i had added path to PYTHONPATH environmental variable. It took a while to find out that I had to prefix the PYTHONPATH entry with a semicolon. before: Blockquote Microsoft Windows [Version 10.0.19043.1348] (c) Microsoft Corporation. All rights reserved. C:UsersUser>echo %PYTHONPATH% "C:StuffProjectsAddress ListsrcAddressListPackage" C:UsersUser>PYTHON Python 3.10.0 (tags/v3.10.0:b494f59, ..

Read more

I have a folder mypackage at the location /mypath/mypackage/, and it contains an __init__.py file which is empty. mypackage contains two python files: packagefile1 and packagefile2, and packagefile2 contains import packagefile1. When I then call a python script at /myotherpath/script.py which contains import packagefile2, it correctly finds packagefile2, but I get an error : Traceback ..

Read more

I am trying to run django in python 3.6.8. When using pip freeze in my activated venv i get this list: asgiref==3.2.3 backports.entry-points-selectable==1.1.1 distlib==0.3.3 Django==3.0.8 django-bootstrap-datepicker-plus==3.0.5 django-crispy-forms==1.9.1 filelock==3.3.2 importlib-metadata==4.8.2 importlib-resources==5.4.0 mysqlclient @ file:///D:/Downloads/mysqlclient-1.4.6-cp36-cp36m-win32.whl Pillow==7.2.0 platformdirs==2.4.0 pytz==2020.1 six==1.16.0 sqlparse==0.3.1 typing-extensions==3.10.0.2 virtualenv==20.10.0 zipp==3.6.0 When i try to run my migrate.py file the following error: Traceback (most recent ..

Read more

I have a project with the following structure: run.py |— /models |——- /adaboost |———— Adaboost.py |———— EstimatorFactory.py (used in Adaboost.py) |——- /me |———— Me.py I already added my project path to $PYTHONPATH hoping absolute imports would work, but i had no success when doing, for instance: #run.py import models.adaboost.Adaboost.AdaboostClassifier #class inside Adaboost.py #or from models.adaboost.Adaboost ..

Read more

I have a project with the following structure: run.py |— /models |——- /adaboost |———— Adaboost.py |———— EstimatorFactory.py (used in Adaboost.py) |——- /me |———— Me.py If current python versions don’t require an __init__.py file, is there a way to define what is exported by a module (i.e. i would like /adaboost module to export AdaboostClassifier by ..

Read more