I ended up deleting the whole Code folder within the C:\Users\AppData\Roaming.
Note: You have to check the box - view Hidden Files to see these folders within File Explorer.
This solved it.
There must have been some weird corrupted cache issue at the heart of this.
I found this in C:\Users<profile>\AppData\Roaming\Code\logs<datetimestamp>\ptyhost.log
[2022-10-17 07:25:50.695] [ptyhost] [warning] Couldn't get layout info, a terminal was probably disconnected Could not find pty on pty host
[2022-10-17 07:25:54.040] [ptyhost] [warning] Shell integration cannot be enabled for executable "C:\Windows\System32\cmd.exe" and args []
[2022-10-17 07:26:57.939] [ptyhost] [warning] Shell integration cannot be enabled for executable "C:\Windows\System32\cmd.exe" and args []
I think it is related to this.
BTW: I had tried adding a couple of PowerShell VSCode IDE Extensions when things went awry. IIRC they were:
- PowerShell
- PowerShell Preview
I had upgraded PowerShell to the latest version 7 too.
$PSVersionTable yielded the following from the respective executables.
| Executable Path | Version |
|---|---|
| C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe | 5.1.17763.1852 |
| C:\Program Files\PowerShell\7\pwsh.exe | 7.2.6 |
Maybe that combo hosed things
Follow up note: Whilst it seemed to have fixed the issue once... soon after the problem manifested itself again. This time I couldn't reset VS Code to a working environment.
- Then I realised had opened the Project folder in the explorer on the left of the IDE.
- I had a subfolder that had a PS1 file within that.
- It didn't have its own .vscode\settings.json
- When I copied it down from the parent folder, suddenly everything worked again.
.vscode\settings.json just contained this:
{
}
Again this ended up being a one time solution. I ended up back at:
Shell activation failed to activate for cmd.exe
I posted this as a new ticket here
- In the end I found this to be more of a display issue than anything else!
- You can actually type cls then hit ENTER, to restore things to the status quo.
- The Terminal section is black with no prompt to begin with. But you can type in it!!!
- Perhaps the Prompt is black text on a black background initally, since when you start typing cls, it's quite a way to the right of the left margin.
I ended up deleting the whole Code folder within the C:\Users\AppData\Roaming.
Note: You have to check the box - view Hidden Files to see these folders within File Explorer.
This solved it.
There must have been some weird corrupted cache issue at the heart of this.
I found this in C:\Users<profile>\AppData\Roaming\Code\logs<datetimestamp>\ptyhost.log
[2022-10-17 07:25:50.695] [ptyhost] [warning] Couldn't get layout info, a terminal was probably disconnected Could not find pty on pty host
[2022-10-17 07:25:54.040] [ptyhost] [warning] Shell integration cannot be enabled for executable "C:\Windows\System32\cmd.exe" and args []
[2022-10-17 07:26:57.939] [ptyhost] [warning] Shell integration cannot be enabled for executable "C:\Windows\System32\cmd.exe" and args []
I think it is related to this.
BTW: I had tried adding a couple of PowerShell VSCode IDE Extensions when things went awry. IIRC they were:
- PowerShell
- PowerShell Preview
I had upgraded PowerShell to the latest version 7 too.
$PSVersionTable yielded the following from the respective executables.
| Executable Path | Version |
|---|---|
| C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe | 5.1.17763.1852 |
| C:\Program Files\PowerShell\7\pwsh.exe | 7.2.6 |
Maybe that combo hosed things
Follow up note: Whilst it seemed to have fixed the issue once... soon after the problem manifested itself again. This time I couldn't reset VS Code to a working environment.
- Then I realised had opened the Project folder in the explorer on the left of the IDE.
- I had a subfolder that had a PS1 file within that.
- It didn't have its own .vscode\settings.json
- When I copied it down from the parent folder, suddenly everything worked again.
.vscode\settings.json just contained this:
{
}
Again this ended up being a one time solution. I ended up back at:
Shell activation failed to activate for cmd.exe
I posted this as a new ticket here
- In the end I found this to be more of a display issue than anything else!
- You can actually type cls then hit ENTER, to restore things to the status quo.
- The Terminal section is black with no prompt to begin with. But you can type in it!!!
- Perhaps the Prompt is black text on a black background initally, since when you start typing cls, it's quite a way to the right of the left margin.
Closing VSCode, verifying that powershell works, then reopening it worked for me.
Shell integration failed to activate
windows - VS Code: "Shell Integration Failed To Activate" - Stack Overflow
visual studio code - VSCode: "Shell Integration failed to activate" - Stack Overflow
Shell integration failed to activate
There are a few potential solutions for this issue.
Make sure that you have the latest version of VS Code and the Shell Integrate extension installed.
Check that the integrated terminal in VS Code is set to the shell you want to use (e.g. PowerShell, Command Prompt, Bash).
Try running VS Code as an administrator.
If you are using Windows, try adding the path of the shell you want to use (e.g. C:\Windows\System32\bash.exe) to the
"terminal.integrated.shell.windows"setting in your VS Code settings.You can also try reinstalling VS Code and your extensions.
If none of the above solutions work, you can try searching for specific error messages in the output panel of VS Code or in the output of the terminal.
You can just close your VS code and restart it again.
Closing VSCode, verifying that powershell works, then reopening it worked for me.
I ended up deleting the whole Code folder within the C:\Users\AppData\Roaming.
Note: You have to check the box - view Hidden Files to see these folders within File Explorer.
This solved it.
There must have been some weird corrupted cache issue at the heart of this.
I found this in C:\Users<profile>\AppData\Roaming\Code\logs<datetimestamp>\ptyhost.log
[2022-10-17 07:25:50.695] [ptyhost] [warning] Couldn't get layout info, a terminal was probably disconnected Could not find pty on pty host
[2022-10-17 07:25:54.040] [ptyhost] [warning] Shell integration cannot be enabled for executable "C:\Windows\System32\cmd.exe" and args []
[2022-10-17 07:26:57.939] [ptyhost] [warning] Shell integration cannot be enabled for executable "C:\Windows\System32\cmd.exe" and args []
I think it is related to this.
BTW: I had tried adding a couple of PowerShell VSCode IDE Extensions when things went awry. IIRC they were:
- PowerShell
- PowerShell Preview
I had upgraded PowerShell to the latest version 7 too.
$PSVersionTable yielded the following from the respective executables.
| Executable Path | Version |
|---|---|
| C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe | 5.1.17763.1852 |
| C:\Program Files\PowerShell\7\pwsh.exe | 7.2.6 |
Maybe that combo hosed things
Follow up note: Whilst it seemed to have fixed the issue once... soon after the problem manifested itself again. This time I couldn't reset VS Code to a working environment.
- Then I realised had opened the Project folder in the explorer on the left of the IDE.
- I had a subfolder that had a PS1 file within that.
- It didn't have its own .vscode\settings.json
- When I copied it down from the parent folder, suddenly everything worked again.
.vscode\settings.json just contained this:
{
}
Again this ended up being a one time solution. I ended up back at:
Shell activation failed to activate for cmd.exe
I posted this as a new ticket here
- In the end I found this to be more of a display issue than anything else!
- You can actually type cls then hit ENTER, to restore things to the status quo.
- The Terminal section is black with no prompt to begin with. But you can type in it!!!
- Perhaps the Prompt is black text on a black background initally, since when you start typing cls, it's quite a way to the right of the left margin.
This is what is literally stopping me from using Roo-Cline. On Windows, set the PowerShell security policy to remote signed, set the default profile to PowerShell, updated to the latest vsCode...
Before the AI executes a command, I get an error when it launches the terminal, or tries, and it is trying to use a cwd command to launch it in a folder that doesn't exist.
Using Gemini flash at the moment just to test whether it can execute or see terminal output.
Anybody have any other suggestions to try?
I'm curious if anyone has managed to fix this error on Windows? On all supported shells, in edition to the Shell Unavailable error I also get an error that the terminal process failed to launch, and the current working directory, which is claims is my desktop, does not exist. Perhaps I should launch VSCode from the start menu and not the desktop shortcut? Ask this on the Cline Discord and nobody helps. I'm guessing most users are on Mac or something; I remember when Mac was laughed at for development.
Newbie here. Just got to while loops and make up something simple when I get to a new concept. I know this is probably going to be a problem with the way its nested but I really haven't touched that subject yet. I just know of it and tried all different types of indentations but nothings working. Even if I enter more than 3 characters, it still returns 'password it too short'. Please guide me to what I'm doing wrong, I don't need you to fix the code. Thanks!
loop = True
correct_password = 'banana'
while loop:
password = input('Password: ')
if password == 'banana':
print('Access Granted!')
break
elif len(password) <= 2:
print('Password too short!')
elif len(password >= 3) and password != correct_password:
print('Password is incorrect!')
pass Your code works just fine if I change this line:
elif len(password >= 3) and password != correct_password:
... to this (note the placement of parentheses):
elif len(password) >= 3 and password != correct_password:
u/MadScientistOR gave you the answer. I just wanted too add.
When you get to that last elif you know 2 things:
-
the password is not 'banana'. because the first
ifcaught that condition. -
the password is longer than 2 characters. because that condition was caught by the second if (the
elifone).
So you don't need to recheck those 2 conditions again. It can become:
while True:
password = input('Password: ')
if password == 'banana':
print('Access Granted!')
break
elif len(password) <= 2:
print('Password too short!')
else:
print('Password is incorrect!')