I'm new to Python, so I think my question is very fundamental and is asked a few times before but I cannot really find something (maybe because I do not really know how to search for that problem). I installed a module in Python (reportlab). Now I wanted to modify a python script in that module but it seems that the python interpreter does not notice the updates in the script. Ironically the import is successful although Python actually should not find that package because I deleted it before. Does Python uses something like a Cache or any other storage for the modules? How can I edit modules and use those updated scripts?
Asked
Active
Viewed 517 times
0
-
Can you please share the code and error? – Dinesh Pundkar Jul 28 '17 at 05:42
-
Read [this](https://stackoverflow.com/questions/2998215/if-python-is-interpreted-what-are-pyc-files) If you are using Python 3, read [this](https://stackoverflow.com/questions/16869024/what-is-pycache). Ultimately, when you *run* your Python code, *.pyc files are created from your *.py files. Those two links will explain what they are. – idjaw Jul 28 '17 at 05:42
-
How did you install the module? – juanpa.arrivillaga Jul 28 '17 at 05:55
-
There is no error. Changes in the module are just not accepted. Well I know that there are created pyc files so I deleted all of them. As I said I even deleted the whole directory (of cause the pyc files included) but I could still import it. I installed the reportlab library manually because there is no way to install it with pip install. – Felix Jul 28 '17 at 06:18
-
Read this https://softwareengineering.stackexchange.com/questions/159044/can-one-edit-a-built-in-python-module – Ahmad Jul 28 '17 at 07:28
1 Answers
2
From what you are saying, you downloaded a package and installed it using either a local pip
or setup.py
. When you do so, it copies all the files into your python package directory. So after an install, you can delete the source folder because python is not looking here.
If you want to be able to modify, edit, something and see changes, you have to install it in editable mode. Inside the main folder do:
python setup.py develop
or
pip install -e .
This will create a symbolic link to you python package repository. You will be able to modify sources.
Careful for the changes to be effective, you have to restart your python interpreter. You cannot just import again the module or whatever else.

tupui
- 5,738
- 3
- 31
- 52