Attach Directory to Pycharm Project

Answered

Is there a way to attach a directory to a project, like you can in DataGrip?  I have a directory w/ SQL files that I want to add to my Pycharm project.  I've tried to add the directory through settings >project > project structure but when I create a new python file,  in that added directory, and try to run it, I always get a "outside contents root directory" error.  I never run into this issue in DataGrip.  I can attach a directory and create and run new SQL files, etc  without a hitch.

5 comments
Comment actions Permalink

Hello, 

I am wondering what version of PyCharm you are running? The latest one is 2020.3

Are you adding it as a content root? Please attach a screenshot of the Project Structure view. 

0
Comment actions Permalink

Hello,

Yes, I am using PyCharm Professional 2020.3 and adding as a content root..  

0
Comment actions Permalink

Hi! I gave it a quick look and it is working OK on my side. Would you kindly reproduce the error and send us idea.log from Help | Show Log in ... at pycharm-support@jetbrains.com ? I would love to look into it.

0
Comment actions Permalink

Hi Pavel,

It seems to work fine when creating and running a .py file.  If i create a .ipynb file, that's where i run into errors.  Any reason why there's that distinction?

0
Comment actions Permalink

I am sorry for the late response. .py and .ipynb are treated differently indeed. There is a complex logic behind .ipynb that handles file rendering (from the underlying json) and Jupyter server management. I believe you are facing a known issue PY-42709.

0

Please sign in to leave a comment.