Forums

Can't find files from stack trace?

Hi all,

I was using the server.log/error.log provided by PythonAnywhere and saw an error in the stack trace:

/usr/local/lib/python3.6/dist-packages/flask_sqlalchemy/__init__.py:839

So I went to find the file so I could fix it, however it is nowhere to be seen.

I went through local/lib/python3.6 but in python3.6 there was only "site-packages" and "flask_sqlalchemy" was not even in there.

Very confused - any ideas where it may be/why it's "hidden"?

Thanks in advance!

Are you trying to find it via the "Files" page? We do hide certain system directories from the root from there. You should be able to get to the file by going to the "Files" page directly, then replacing the "/home/JJByte" at the end of the URL with "/usr/local/lib/python3.6/dist-packages/flask_sqlalchemy/"

Yes I was trying to access it via the "Files" page - and great thank you, that works! The only problem now is that I can't seem to edit any of the files (even if they are normal .py files). I'm guessing this is again something to do with the hiding of certain system directories but is there anyway to change this? Thank you!

Those files aren't editable, unfortunately -- they're part of the Python installation. What do you want to change them to do? There might be a better way to achieve what your goal.

Oh, hmm. I installed a plugin and some of the code is erroring - I wanted to go in and fix it! There are also plugins (such as Flask-Admin) that have editable code to customise the logic which I want to edit.

Thanks!

You can install packages as editable using pip. Though I think it's unlikely that you'd need to edit the installed packge file to customise your installation.

I'm almost certain I installed it using pip - that's weird. Also, I don't want to customise the installation, I just want to edit one of the files!

If you installed something through pip using the --user flag, it wouldn't be installed to /usr/local/lib/python3.6/. That is the system python libraries. Instead, it should be installed to /home/JJByte/.local.

I would also recommend using a virtualenv if the system libraries are getting all mixed up with your own libraries.