Opening a new Project

I’ve been trying to create a new project under this path.
It tells me this message.
Does this mean that before creating a new project in PyCharm I need to create an empty file and then the path of the new project that new file?

Yes, you should create an empty directory for each new project. PyCharm will store some project-specific information in a sub-directory named .idea [1]. It’s a little rigid but it does force you to organize your code.

If you had code from somewhere else (e.g. you cloned a Git repository), you could open that directory in PyCharm and use the “create from existing sources”. But when you are starting a new project you should start with an empty directory.

  1. last I checked ↩︎

1 Like

Largely agree with the previous answer. It also pays to line-up an external git repo before-hand (if using one) to simplify the establishment of links/management/governance.

However, to your question: It doesn’t matter. Use the “Create…” option - you won’t lose any work! PyCharm is registering the fact that there is already a directory with the same name as this new project. Perhaps that’s a mistake? However, it is not (in this case). So, it will now add all those project-goodies that it needs to your existing structure.

IIRC, have never tried the “Open…” choice. It might wipe-clean, or it might not…

Occasionally, I start something in one project’s directory (obvious example, I have a “PythonExperiments” ‘project’ which apart from ‘what it says on the can’ I also use when questions here or from trainees need to be stored in a file (cf using the REPL) ). If an idea grows (like Topsy), as inspiration strikes, it may be that I want to move the files into their own project. Thus, most often move the files into their new directory/home, and only then think about telling PyCharm it is a new project, and only thereafter remember the git repo… Doh! (it’s one of those things that what seems the easier course at-first, ends-up taking longer and/or requiring the jumping-through of more hoops… YMMV!

1 Like

A project can involve many files, so there should be a folder that contains them.

PyCharm thinks that you want to use everything that is on your Desktop already as part of the new project you are making. When you give it a path for a new project, that’s the path it expects for the folder that directly contains the project files - not for a place to put a new folder for the project. (That’s why it doesn’t have to ask you separately about the new folder name.)

If you want a new project that is on your desktop, first make a new empty folder (not file) on the desktop that will contain the project files, yes.

1 Like

I agree, and strongly recommend having a directory for every project. This is how many tools will think about “one project” - it’s a directory and whatever subdirectories it has. You can, for example, have a requirements.txt for each project, listing the packages that it depends on. You can have a README (or or README.rst etc) to give some explanation of what the project does, and a LICENSE or COPYING to tell people how they’re allowed to use your code.

Also, this is how source control tools like git tend to work - one directory corresponds to one repository, making it easy to keep your code organized, keep everything tidy, and so on.


Thank you!