When I run my Main.py
script, PyCharm keeps telling me Cannot start process, the working directory /home/myname/PyCharmProjects/MyProjectName/mypackage does not exist
.
This error occurred after creating a package (mypackage
) for test purposes, moving files to it (including Main.py
), and moving the files back to the root folder afterwards.
The package mypackage
was empty after that, but PyCharm still thought that Main.py
is located in that package. I could still run the program until I deleted the empty package, but path errors occurred. After deleting the package, I was unable to start it.
- I can still run the other files that used to be in
mypackage
and are now in my root directory again. - I can still create and run new files in my root directory.
alex
6,3319 gold badges50 silver badges102 bronze badges
asked Oct 20, 2015 at 6:26
It happens because when you create a file it automatically assigns the working directory to it’s configuration, which of course is the one where you created it.
You can change that by going into Run -> Edit Configurations
. Click on the folder icon in Script path:
and correct the path to the file. Click OK
to save and you should be able to Run
the file again.
fbicknel
1,09911 silver badges20 bronze badges
answered Jan 11, 2017 at 14:33
GuestGuest
4214 silver badges2 bronze badges
4
After testing for a bit, I’ve found a solution (but not an answer to why this error occurs in PyCharm):
Delete the file and create it again. (Or rename or move it and create a new file with its old name, both should work.)
answered Oct 20, 2015 at 6:27
R.G.R.G.
8111 gold badge7 silver badges16 bronze badges
2
Set the working directory correctly
1. File-> Settings
2. Build, Execution, Deployment -> Console -> Python Console
3. Working directory: [The path to the directory where the file you’re currently working on resides.]
answered Jun 5, 2021 at 21:32
victorkolisvictorkolis
72010 silver badges13 bronze badges
I had the same problem, mine is probably related to the explaination gave by the others, it comes from the dir .idea
, files *.xml
contain the variable $DIR_PROJECT$
.
Therefore, as the attribution of a new path didn’t work, I just deleted my .idea
, that is automatically loaded each time I open my project’s directory.
It automatically regenerated the .idea
, asked for the script path… And it worked perfectly
CAREFUL => You will automatically lose your project settings, you are deleting the «settings file»
answered Feb 25, 2019 at 8:33
NqsirNqsir
75910 silver badges19 bronze badges
I was getting this same error, and the path in «edit configurations» was correct.
However, this is what eventually got my code working again.
1) I commented out all of the code in my file («ctrl» + «a» + «ctrl» + «/»)
2) I commented something I knew would compile in the file. (my list of imports)
3) I ran the python file.
This time, it actually completely compiled and after that I was able to uncomment the rest of my code and everything worked again.
answered Jan 25, 2019 at 14:33
The issue kept popping up over and over in PyCharm. So I created a new project and loaded the needed script. Then I provided the directory to path and assigned the default Python version that I wanted to use… and it worked. Then I was able to finally use «execute line in console» once again.
Kevin
15.6k7 gold badges53 silver badges70 bronze badges
answered Dec 5, 2019 at 13:45
I had this problem because I renamed my project, it was «xx» I renamed it to «yy», what I did was I went through the directory of .idea in the «yy», in any of those files (all XML files) if there were the name «xx», I replaced it with «yy»
answered Jun 17, 2021 at 9:10
I experienced this problem after moving my project to a different root directory. None of the above solutions worked for me.
I solved it by opening my entire project folder, instead of just the python file I was trying to run. And then running the file I wanted, while the entire project was loaded into PyCharm.
answered Aug 26, 2021 at 17:46
SheldonfrithSheldonfrith
1,5282 gold badges10 silver badges14 bronze badges
open the qtdesigner work dictionary setting and choose your project path then click OK, don’t not use the mysterious work dictionary path by default
answered Dec 2, 2021 at 3:43
In my case Run
-> Edit Configuration
didn’t help.
I’ve solved it changing the value of «WORKING_DIRECTORY» attribute in .idea
-> workspace.xml
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/your/correct/path/here" />
answered Jan 16, 2022 at 10:55
MarcelMarcel
3943 silver badges8 bronze badges
I am a beginner so appreciated this 6 year and 6 month discussion. I couldn’t add a comment. I setup PyCharm 2022.1.1 and a Python 3.10.4 virtual environment with pyside2 and pyside6 on Ubuntu 22.04. I tried all the suggestions above and could get none of them to work for me. Following these instructions: https://pythonpyqt.com/how-to-install-pyqt5-in-pycharm/ both pyside2-designer (Qt5Designer) and pyside6-designer from my virtual environment were added as external tools. pyside2-designer failed with the working directory error and pyside6-designer worked without any error. Looking closer at pyside2-designer selecting the working directory with the browse button, I still could not create file — exit code was 127 — but the Qt5 Designer was available for existing ui files. I used pyside2 because PyQt5-tools could not be pip
installed in my python3.10.4 virtual env.
answered May 16, 2022 at 1:52
1
This worked for me on PyCharm 2021.3.2
:
answered Aug 27, 2022 at 13:49
ContangoContango
74.7k57 gold badges252 silver badges300 bronze badges
Содержание
- I’m a coder. Welcome to my blog. Here are some of the records on my job.
- Categories
- PyCharm tells me & ldquo; can not start the process, the working directory and hellip; does not exist «
- PyCharm говорит мне: «Не могу запустить процесс, рабочий каталог… не существует»
- 5 ответов
- Alexandre VIOT
- A blog about Microsoft Technologies
- Powershell – Start-Process Credential error
- Start-Process Credential errors
- User Membership
I’m a coder. Welcome to my blog. Here are some of the records on my job.
Categories
PyCharm tells me & ldquo; can not start the process, the working directory and hellip; does not exist «
I’ve seen this question being asked before (at least twice), but I haven’t found a solution so far, so I’ll ask the question again with some more details.
The Problem
When I run my python main file, PyCharm keeps telling me Cannot start process, the working directory /home/myname/PyCharmProjects/MyProjectName/mypackage does not exist .
When did this error occur?
After I created a package mypackage for test purposes, moved files to it (inluding my main file), and moved the files back to the root folder afterwards.
The package mypackage was empty after that, but PyCharm still thought that the main file ( Main.py ) is located in that package. I could still run the program until I deleted the empty package, but path errors occurred. After deleting the package, I was unable to start it.
Additional Info
- I can still run the other files that used to be in mypackage and are now in my root directory again
- I can still create and run new files in my root directory
It happens, because when you create a file it automatically assigns the working directory to it’s configuration, which of course is the one where you created it. You can change that by going into Run -> Edit Configurations.
Источник
PyCharm говорит мне: «Не могу запустить процесс, рабочий каталог… не существует»
Я уже видел этот вопрос (хотя бы дважды), но пока не нашел решения, поэтому еще раз задам вопрос с некоторыми подробностями.
Проблема
Когда я запускаю свой основной файл python, PyCharm постоянно говорит мне Cannot start process, the working directory /home/myname/PyCharmProjects/MyProjectName/mypackage does not exist .
Когда возникла эта ошибка?
После того, как я создал пакет mypackage для целей тестирования, переместил в него файлы (включая мой основной файл) и впоследствии переместил файлы обратно в корневую папку.
После этого пакет mypackage был пуст, но PyCharm все еще думал, что основной файл ( Main.py ) находится в этом пакете. Я все еще мог запустить программу, пока не удалил пустой пакет, но произошли ошибки пути. После удаления пакета я не смог его запустить.
Дополнительная информация
- Я все еще могу запустить другие файлы, которые раньше были в mypackage и теперь снова в моем корневом каталоге
- Я все еще могу создавать и запускать новые файлы в моем корневом каталоге
5 ответов
После небольшого тестирования я нашел решение (но не ответ на вопрос, почему эта ошибка возникает в PyCharm):
Удалите файл и создайте его снова. (Или переименуйте или переместите его и создайте новый файл со старым именем, оба должны работать.)
Проблема постоянно всплывала в PyCharm. Поэтому я создал новый проект и загрузил нужный скрипт. Затем я указал каталог для path и назначил версию Python по умолчанию, которую я хотел использовать . и это сработало. Тогда я смог наконец использовать «выполнить строку в консоли» еще раз.
У меня была та же проблема, моя, вероятно, связана с объяснением, данным другими, оно исходит из каталога .idea , файлы *.xml содержат переменную $DIR_PROJECT$ .
Поэтому, поскольку указание нового пути не работало, я просто удалил свой .idea , который автоматически загружается каждый раз, когда я открываю каталог моего проекта.
Он автоматически восстановил .idea , запросил путь к сценарию . И он работал отлично
ОСТОРОЖНО => Вы автоматически потеряете настройки проекта, вы удаляете «файл настроек»
Я получил эту же ошибку, и путь в «редактировать конфигурации» был правильным. Тем не менее, это то, что в итоге заставило мой код снова работать.
1) Я закомментировал весь код в моем файле («ctrl» + «a» + «ctrl» + «/»)
2) Я прокомментировал кое-что, что, как я знал, скомпилируется в файл. (мой список импорта)
3) Я запустил файл с питоном. На этот раз он фактически полностью скомпилирован, и после этого я смог раскомментировать оставшуюся часть кода, и все снова заработало.
Это происходит потому, что когда вы создаете файл, он автоматически назначает рабочий каталог своей конфигурации, которая, конечно же, является той, где вы его создали.
Вы можете изменить это, зайдя в Run -> Edit Configurations . Нажмите на значок папки в Script path: и исправьте путь к файлу. Нажмите OK для сохранения, и вы сможете снова Run файл.
Источник
Alexandre VIOT
A blog about Microsoft Technologies
Powershell – Start-Process Credential error
With Windows Powershell, we are able to start a process as another user, with the command Start-Process Credential parameter. But in some conditions, you will get this error: The system cannot find the file specified. or The Directory name is invalid.
Start-Process Credential The file cannot find the file
The error occurs only if the parameter Credential is set. If not, Internet Explorer is starting. Let’s see how to resolve this issue.
Start-Process Credential errors
Maybe you tried to execute the powershell command:
Start-Process -credential (Get-Credential) -FilePath «iexplore.exe»
Start-Process The file cannot find the file
Even with the full path specified, another error occurs: The Directory name is invalid.
Start-Process -credential (Get-Credential) -FilePath «C:Program Files (x86)Internet Exploreriexplore.exe»
The Directory Name is invalid
The Start-Process cmdlet has the WorkingDirectory parameter. If we use it with the executable name, the error is one again: The system cannot find the file specified.
Start-Process -credential (Get-Credential) -FilePath «iexplore.exe» -WorkingDirectory «C:Program Files (x86)Internet Explorer»
Start-Process Working Directory error
After troubleshooting, these errors occur when the $HOMEDRIVE and $HOMEPATH are set on the logged user account. This can be done by GPO or on the account properties.
The workaround is to use the full path of the executable AND use the working directory:
Start-Process -credential (Get-Credential) -FilePath «C:Program Files (x86)Internet Exploreriexplore.exe» -WorkingDirectory «C:Program Files (x86)Internet Explorer»
Start-Process Credential no errors
User Membership
When you try to run a process on a computer with a external user in a trusted forest, the user must be in the local computer Users group. Otherwise you will get an Access Denied error.
You can get more information about the cmdlet Start-Process here.
Источник
After testing for a bit, I’ve found a solution (but not an answer to why this error occurs in PyCharm):
Delete the file and create it again. (Or rename or move it and create a new file with its old name, both should work.)
It happens because when you create a file it automatically assigns the working directory to it’s configuration, which of course is the one where you created it.
You can change that by going into Run -> Edit Configurations
. Click on the folder icon in Script path:
and correct the path to the file. Click OK
to save and you should be able to Run
the file again.
Set the working directory correctly
1. File-> Settings
2. Build, Execution, Deployment -> Console -> Python Console
3. Working directory: [The path to the directory where the file you’re currently working on resides.]
I had the same problem, mine is probably related to the explaination gave by the others, it comes from the dir .idea
, files *.xml
contain the variable $DIR_PROJECT$
.
Therefore, as the attribution of a new path didn’t work, I just deleted my .idea
, that is automatically loaded each time I open my project’s directory.
It automatically regenerated the .idea
, asked for the script path… And it worked perfectly
CAREFUL => You will automatically lose your project settings, you are deleting the «settings file»
I’ve seen this question being asked before (at least twice), but I haven’t found a solution so far, so I’ll ask the question again with some more details.
The Problem
When I run my python main file, PyCharm keeps telling me Cannot start process, the working directory /home/myname/PyCharmProjects/MyProjectName/mypackage does not exist
.
When did this error occur?
After I created a package mypackage
for test purposes, moved files to it (inluding my main file), and moved the files back to the root folder afterwards.
The package mypackage
was empty after that, but PyCharm still thought that the main file (Main.py
) is located in that package. I could still run the program until I deleted the empty package, but path errors occurred. After deleting the package, I was unable to start it.
Additional Info
- I can still run the other files that used to be in
mypackage
and are now in my root directory again - I can still create and run new files in my root directory
It happens, because when you create a file it automatically assigns the working directory to it’s configuration, which of course is the one where you created it. You can change that by going into Run -> Edit Configurations.
Error: Cannot start process, the working directory does not exist
I got this error on Pycharm Python Console. It’s an error running console.
To solve it, just remove .idea folder in your project and re run Pycharm.
Enjoy it!
Popular posts from this blog
from: can’t read /var/mail/ in Python scripts
If you add a Python file to your PATH, maybe you will see this error: from: can’t read /var/mail/$First_Library_Name This happend, because you need to be explicit with application you want to run your script. To fix it, just add in the first line of your script the following line: #! /usr/bin/python Enjoy it!
How to fix Android when developer options are not available for this user
I have an Android One with Oreo version and suddenly my Android rebooted and after that it started to behave strangely: 1) Notification section doesn’t work. I can’t see notifications from my apps and the arrow and the screw icon to settings access don’t work. 2) As I can’t access to the notification area, I can’t enable Use USB to Transfer Files to access to my phone memory. 3) I can’t access to developer mode (I before active it with a lot of taps over Build number). Clicking on developer options just shows developer options are not available to this user. 4) I can’t update or install the apps on google play. They freeze on Download pending… message 5) Home and Switch buttons don’t work. They light up and vibrate when I tap them but they do nothing. This issue is apparently related to a deconfiguration of user accounts. To fix it, you need re-setup the users. As you can’t access to the user manager (you are in guest mode
Exception: Could not find a default OpenFlow controller in Mininet
If you try to run a mininet script like this , maybe you will get this problem if you are under Ubuntu. Exception: Could not find a default OpenFlow controller This is trigger because your system don’t find a default controller . To enable it just add the first line and add the controller argument to net variable like the second line: from mininet.node import OVSController net = Mininet(topo=topo,host=CPULimitedHost, link=TCLink,controller = OVSController) Now, you will get the following error: c0 Cannot find required executable ovs-controller. Please make sure that it is installed and available in your $PATH: (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin) ovs-controller is a legacy name. You need to be sure that you has it. sudo apt-get install openvswitch-testcontroller sudo cp /usr/bin/ovs-testcontroller /usr/bin/ovs-controller If you run it again, you should kill ovs-testcontroller first to avoid this: Exception: Please shut d