When using processing.py, I often have to open projects with multiple files inside a single folder. Every time I try opening the main file Processing wants to create a new folder even if the folder I am working with has already the same name than my script.
This leads to a project with a path like this: “… \ Crowd_Model \ Crowd_Model \ Crowd_Model …”. It is annoying and I don’t know why it occurs. Is it because of the other scripts or because of the name of the file? I did not find a topic about this problem so I hope someone will know why I have this issue.
My folder: “Crowd_Model”
Files inside the folder:
“Agent$py.class”
“Agent.py”
“Crowd_Model.py”
“Point$py.class”
“Point.py”
“QuadTree$py.class”
“QuadTree.py”
“Rectangle$py.class”
“Rectangle.py”
My Projects in Java work with no issues. When the issue occurs, it is possible that the message disappear (but still runs on the computer) and makes it impossible to open processing again without closing this error message (I used the task manager to fix this).
I tested this on my computer, but couldn’t replicate the problem. Perhaps I’ve done something differently? What version of Processing and OS are you running?
Note that the main sketch file (Crowd_Model.pyde) has a .pyde extension. The Crowd_Model class has a .py extension. When I run Processing, I open the pyde file, and the rest automatically appear in the tabs.
Welcome @daphnakaplan – could you provide a screenshot of your project files? This likely has something to do with how you’ve named/structured your files.
Here is an example:
Let’s say I have a folder named test and a test.pde && test2.pde files inside
I can open both files (in tabs) no problem
However,
If I have a test2.pde inside a ‘test’ folder - impossible to open without creating a new folder called ‘test2’
I guess this is intentional? but why? it makes files management very messy
All Processing projects are called sketches. Each sketch has its own folder. The main file for each sketch has the same name as the folder and is found inside. For example, if the sketch is named “Sketch_123”, the folder for the sketch will be called “Sketch_123” and the main file will be called “Sketch_123.pde”. The PDE file extension is an acronym for the Processing Development Environment
Processing sketches can be stored anywhere on your computer, but by default they are stored in the sketchbook, which will be in different places on your computer or network depending if you use PC, Mac, or Linux and how the preferences are set. To locate this folder, select the “Preferences” option from the File menu (or from the “Processing” menu on the Mac) and look for the"Sketchbook location."
A sketch folder sometimes contains other folders for media files and other code. When a font or image is added to a sketch by selecting “Add File…” from the Sketch menu, a “data” folder is created. Files may also be added to your Processing sketch by dragging them into the text editor. Image and sound files dragged into the application window will automatically be added to the current sketch’s “data” folder. All images, fonts, sounds, and other data files loaded in the sketch must be in this folder.
Python mode requires that each sketch resides in a folder with the same name as the sketch itself. So, test.pyde is located in a folder named test; test2.pyde is located in a folder named test2.
If you want to work on multiple sketches simultaneously, you launch separate instances of the Processing editor.
The editor tabs are for working on multi-file sketches. When you’re working on something complex, it’s useful to break up your Python code into multiple files. For example, you have a folder named tetris, which contains a tetris.pyde, brick.py, timer.py, etc. files. The tetris.pyde is the file you run; you import the code from the other files into this. The .py files will appear in the tabs (so you can easily switch to and work on them).
There are ways to run Python Mode files outside of the Processing editor (from the command line) that will allow you to organise your files differently.
As you’ve posted your question in the Processing.py section of the forum, I’ve used a Python example. If you’re using Java mode, the same (what I wrote above) is true, except all of the file extensions are .pde not .pyde/.py