sys.path Questions

5

Solved

I had a file called example_file.py, which I wanted to use from various other files, so I decided to add example_file.py to sys.path and import this file in another file to use the file. To do so, ...
Phinney asked 4/9, 2012 at 6:15

4

I have been trying to fix the python path on my cpu, and I originally was just trying to change my .bash_profile, but that wasn't working, so I used import sys sys.pat.append(path/To/Module) and n...
Nifty asked 23/6, 2016 at 17:14

10

Solved

I want to get the parent of current directory from Python script. For example I launch the script from /home/kristina/desire-directory/scripts the desire path in this case is /home/kristina/desire-...
Finnish asked 13/5, 2015 at 15:7

2

Solved

UPDATE - A solution was found, see comments, and the end of this post for further details I am using Jupyter Notebook in VS Code, and trying to export my notebook to HTML through the Notebook menu ...

6

Solved

Currently, when trying to reference some library code, I'm doing this at the top of my python file: import sys sys.path.append('''C:\code\my-library''') from my-library import my-library Then, m...
Ketonuria asked 19/9, 2011 at 14:22

0

I have installed a package with python setup.py install --user It looks it had been done in anaconda (base), though I can't remember. The module was installed in $HOME/.local/lib/python3.6/site-p...
Freund asked 21/7, 2020 at 9:5

6

Solved

Another developer and I disagree about whether PYTHONPATH or sys.path should be used to allow Python to find a Python package in a user (e.g., development) directory. We have a Python project with ...
Stature asked 12/12, 2009 at 14:33

1

Solved

I want to import a module in a project and it gives me lots of troubles because of an import error. So I decided to write a little test to see where the problem lies. I add a folder to my sys path ...
Spohr asked 22/11, 2019 at 8:21

4

On my system, I have several modules installed multiple times. To give an example, numpy 1.6.1 is installed in the standard path at /usr/lib/python2.7/dist-packages, and I have an updated version o...
Mock asked 23/5, 2014 at 15:8

2

Solved

I've installed some packages during the execution of my script as a user. Those packages were the first user packages, so python didn't add ~/.local/lib/python2.7/site-packages to the sys.path befo...
Carrycarryall asked 19/8, 2014 at 13:39

1

Solved

According to documentation, sys.path is initialized from PYTHONPATH when a Python interpreter session starts. However, in my case, PYTHONPATH variable is empty. When I execute this in a terminal: e...
Wilkey asked 3/2, 2018 at 16:24

3

Solved

I have all my .py files inside a folder script and all my IPython-notebooks under a folder named Notebook. There are multiple cross dependencies for each notebook file on one or more files on scr...
Bevel asked 7/7, 2016 at 3:51

1

Consider a Python project like this: foo/ __init__.py scripts/ run.py demo.sh Under normal circumstances, attempting to import from the foo package will fail if you run the script from the roo...
Namedropping asked 9/11, 2015 at 17:54

4

I want to ensure that os.environ and sys.path are identical for all ways we start the Python interpreter: web requests via Django, and Apache mod_wsgi Cron jobs Interactive logins via ssh Celery j...
Loadstar asked 5/2, 2016 at 12:5

1

Solved

Some library does change my sys.path in a way that I don't want it to. But I can't find it. The affected virtualenv has a lot of libraries installed. I replaced sys.path with a own class which al...
Committeewoman asked 19/10, 2015 at 10:47

1

Solved

Things were working fine a moment ago. I have no idea what I did to piss off virtualenv, but it's acting very strangely now. Any help is appreciated. When making a virtualenv, I use this command: ...
Gilmer asked 9/4, 2015 at 2:56

1

Solved

Due to a specific problem which I managed to solve, I spent most of today figuring out how site.py(s) work. There is a point which I don't understand. As far as I understand, when python is loaded...
Kauffman asked 7/9, 2014 at 21:41

2

Solved

My situation is as follows: I have a locally installed version of python. There exists also a global one, badly installed, which I do not want to use. (I don't have admin priviliges). On /usr/loc...
Faultfinder asked 7/9, 2014 at 13:32

0

I'm confused about the rules used to construct my Python sys.path. I understand that the fist entry will be "the directory containing the script that was used to invoke the Python interpreter", or ...
Giliane asked 20/1, 2014 at 14:21

2

Solved

Here is my directory structure: /home/dmugtasimov/tmp/name-res root tests __init__.py test_1.py __init__.py classes.py extra.py root.py File contents: root/tests/_init_.py import os, s...
Jackquelin asked 6/1, 2013 at 15:21

2

Solved

When a non built-in module is imported, the interpreter searches in the locations given by sys.path. sys.path is initialized from these locations (http://docs.python.org/library/sys.html#sys.path):...
Dig asked 8/6, 2012 at 19:32

2

Solved

I've tried adding the following line to my handler script (main.py), but it doesn't seem to work: sys.path.append('subdir') subdir lives in the my root directory (i.e. the one containing app.y...
Belligerence asked 1/3, 2010 at 6:11
1

© 2022 - 2024 — McMap. All rights reserved.