0

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?

5
  • Can you please share the code and error? Commented Jul 28, 2017 at 5:42
  • Read this If you are using Python 3, read this. Ultimately, when you run your Python code, *.pyc files are created from your *.py files. Those two links will explain what they are. Commented Jul 28, 2017 at 5:42
  • How did you install the module? Commented Jul 28, 2017 at 5: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. Commented Jul 28, 2017 at 6:18
  • Read this softwareengineering.stackexchange.com/questions/159044/… Commented Jul 28, 2017 at 7:28

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.