Python not working in the command line of git bash
Asked Answered
S

21

369

Python will not run in git bash (Windows). When I type python in the command line, it takes me to a blank line without saying that it has entered python 2.7.10 like its does in Powershell. It doesn't give me an error message, but python just doesn't run.

I have already made sure the environmental variables in PATH included c:\python27. What else can I check?


A session wherein this issue occurs looks like the following:

user@hostname MINGW64 ~
$ type python
python is /c/Python27/python

user@hostname MINGW64 ~
$ python

...sitting there without returning to the prompt.

Selfsown answered 15/9, 2015 at 23:18 Comment(7)
"Nothing happens"? You don't even get an error? (Which is to say: If you get an error message, that should be part of your question).Aurar
@recursive, bash does indeed respect PATH. (It has its own version of that variable, though).Aurar
I do not get an error message when I type in python. It just takes me to a blank line, but doesn't show that python is actual runningSelfsown
@CharlesDuff, she made it clear, Charles, no any error messages. Bash just freezes. Freezing a terminal is the error message.Irresolution
similar question here: stackoverflow.com/questions/13588454/… using python -i solves it.Ecclesiastes
Related follow-up question: Winpty and Git Bash--What is winpty?Bespread
What i found is that if I install GUI git Bash, there is a screen that ask for "Enable experimental support for pseudo console This alows running nabve console programs Ike Node or Python in a Git Bash whdow without using whpty, but is enfortunately not quite stable yet" If i select this Python works from the command line.Mouth
M
534

Temporary solution

Just enter this in your git shell on windows - > alias python='winpty python.exe', that is all and you are going to have alias to the python executable. This alias will be valid for the duration of the shell session.

winpty is a Windows software package providing an interface similar to a Unix pty-master for communicating with Windows console programs.

Permanent solution

Add the command to your .bashrc in the users home directory. You can use the CLI or a text editor:

Using CLI

This can be accomplished from git bash like so:

echo "alias python='winpty python.exe'" >> ~/.bashrc

which will create .bashrc in the current users home directory if the file doesn't exist or append the alias to the end of .bashrc if it does.

Using a text editor

Alternatively, you could first create a .bashrc. Depending on your file manager, this may be easier to accomplish in git bash like so:

cd ~
touch .bashrc

At which point you can open .bashrc in your prefered text editor and add it there.

To apply the change, either use the command source .bashrc or restart the shell.

Update

Newer versions of Git no longer use .bashrc but instead use .bash_profile. Conda also uses this profile when initializing, so be sure not to overwrite or delete the initialization block. See more here: Git for Windows doesn't execute my .bashrc file.

Macpherson answered 10/4, 2016 at 14:5 Comment(18)
Note: You will have to use the Python function quit() in order to escape out of the interpreter.Therapist
You can also use (the windows standard) ^Z (ctrl-Z) + return to exit.Walker
Also if you would like to set the alias to a 'different' python than that from windows you can set a fully qualified path to it using the following syntax alias python='winpty /c/Python27/python.exe'Shocking
winpty python.exe throws Error 0x2 starting python.exe for me, but winpty python works.Nippers
You can also run source .bashrc instead of restarting the shell.Casillas
@Sudicode, there are a number of ways you can achieve the same. This is just suggested edit from another user. Feel free to add, suggest edits to better the answer.Macpherson
this worked for me, but is there a way to fix the same problem with pip install X? making a similar alias for pip.exe did not work.Armrest
@Armrest hm, I've checked my bashrc again and my path etc. pip is working fine w/o any other modificationsMacpherson
@VitaliyTerziev I eventually figured it out using https://mcmap.net/q/12602/-pip-command-does-nothing and "--no-cache-dir" flag.Armrest
This works for ipython.exe as well. (I'm not sure why one of my Windows computers requires the winpty command and the other does not.)Amu
I had the same problem and this solution works for me. Why exactly is it necessary, though? What's going on under the hood?Rida
@KarlKnechtel, I think Charles Duffy's answer has more information about the bug which is causing this and possible workarounds. If I remember correctly my suggestion was a derivative based on the details in his answer.Macpherson
Git bash should really explain the effects of installing minty console better. Perhaps even link to this answer :)Tinned
append that to your .bash_profile on windows 10 (be careful if you have conda to append the line and not override your .bash_profile created by conda init)Mamba
One more note: once you add the alias to your .bashrc file, make sure to source that file (if you need python immediately), or else you'll need to restart git bash.Kelleykelli
this works for me, but I just don't quite understand the purpose of winpty. it was not needed in the past.Drongo
If I use winpty, when I copy the output of python script containing lengthy chars, upon pasting it gets converted to multi lines. More: github.com/microsoft/terminal/issues/6901Ike
Great answer. I used your alias. For anyone also wanting Linux-style hash-bangs to work so you can run Python scripts like this: ./hello_world.py, I explain how in my new answer here.Bespread
L
129

I don't see next option in a list of answers, but I can get interactive prompt with "-i" key:

$ python -i
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55)
Type "help", "copyright", "credits" or "license" for more information.
>>> 
Lennie answered 29/9, 2016 at 19:44 Comment(5)
-i argument: When a script is passed as first argument or the -c option is used, enter interactive mode after executing the script or the command, even when sys.stdin does not appear to be a terminal. The PYTHONSTARTUP file is not read. docs.python.org/3/using/cmdline.html#cmdoption-iJorry
Is this more costly than alias python='winpty python.exe' ?Glitter
this is the option with zero configuration effort that works on any computer.Lennie
doesn't actually work to get the terminal to function properly. keyboard up/down doesn't work for example. unless winpty is run firstThurstan
This worked for me for python in windows, it will even pick the correct python to use if you run it within an active virtual evKiker
A
72

This is a known bug in MSys2, which provides the terminal used by Git Bash. You can work around it by running a Python build without ncurses support, or by using WinPTY, used as follows:

To run a Windows console program in mintty or Cygwin sshd, prepend console.exe to the command-line:

$ build/console.exe c:/Python27/python.exe
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> 10 + 20
30
>>> exit()

The prebuilt binaries for msys are likely to work with Git Bash. (Do check whether there's a newer version if significant time has passed since this answer was posted!).


As of Git for Windows 2.7.1, also try using winpty c:Python27/python.exe; WinPTY may be included out-of-the-box.

Aurar answered 16/9, 2015 at 3:38 Comment(6)
Can you please, explain the build/console.exe c:/Python27/python.exe - is this should be run in GitMsys console or any other way?Sulphur
@h3d0, yes, inside the terminal. Of course, this assumes that build is the directory that console.exe is in; update the path appropriately depending on where/how you actually installed it.Aurar
Searched the whole system for console.exe - no occurrences. Is this something to be installed additional?Sulphur
@h3d0 Yes, it is additional software; my answer includes a link.Aurar
I think you can use it as winpty c:/Python27/python.exe, without doing anything additional. The utility winpty.exe can be found at Git\usr\bin. I'm using Git for Windows v2.7.1Petronilapetronilla
Python now starts, but I can't type brackets ([]) for some reason. It works in git bash outside of python, as well as in python when I run it from cmd.Nocti
B
63

I am windows 10 user and I have installed GIT in my system by just accepting the defaults.

After reading the above answers, I got 2 solutions for my own and these 2 solutions perfectly works on GIT bash and facilitates me to execute Python statements on GIT bash.

I am attaching 3 images of my GIT bash terminal. 1st with problem and the latter 2 as solutions.

PROBLEM - Cursor is just waiting after hitting python command

enter image description here

SOLUTION 1

Execute winpty <path-to-python-installation-dir>/python.exe on GIT bash terminal.

Note: Do not use C:\Users\Admin like path style in GIT bash, instead use /C/Users/Admin.

In my case, I executed winpty /C/Users/SJV/Anaconda2/python.exe command on GIT bash

Or if you do not know your username then execute winpty /C/Users/$USERNAME/Anaconda2/python.exe

enter image description here

SOLUTION 2

Just type python -i and that is it.

enter image description here

Thanks.

Baez answered 20/3, 2018 at 12:49 Comment(0)
R
18

Try python -i instead of python, it's a cursor thing.

Robenarobenia answered 22/5, 2019 at 20:1 Comment(0)
B
14

Git Bash Workaround- Launch Python 2 & Python 3 with aliases

HI. This is (for me) the best solution to run both Python (Python 2.7 and Python 3.x) directly from Git Bash on Win 10 => adding aliases into the aliases file that Git Bash uses for.

Git Bash aliases file is aliases.sh. It is located in:

C:\path where you installed Git\etc\profile.d\aliases.sh

1) Open (with a text editor like Atom or other) the aliases.sh

for ex: in my case the file is in C:\Software\Develop\Git\etc\profile.d\aliases.sh

2) Add your alias for Python

In my case the python.exe are installed in:

C:\Networking\Network Automation\Python 2.7\python.exe
C:\Networking\Network Automation\Python 3.7\python.exe

So you must create 2 aliases, one for Python 2 (I named python2) and the other for Python 3 (I named just python) Git Bash uses linux file structure so you need to change the "\" for "/" and if you have a path like my example Network Automation you put it with " "

"Network Automation", for ex.

winpty is the magic command that will call the executable.

So add these lines at the beginning of aliases.sh

alias python2='winpty C/Networking/"Network Automation"/"Python 2.7"/python.exe'
alias python='winpty C/Networking/"Network Automation"/"Python 3.7"/python.exe'

3) Add or Modify other aliases (if you want)

I modified also the ll alias to show all the files and in a human readable list:

alias ll='ls -lah'

4) Save the aliases.sh file


5) OK!!! close and relaunch your Git Bash

Now, permanently you could launch both Python directly from Git shell just writting

$ python -> launch Python 3

$ python2 -> launch Python 2

$ ll -> enters a ls -lah to quickly show your detailed file list

Cheers, Harry

Bibliomancy answered 21/5, 2019 at 17:7 Comment(0)
H
12

2 workarounds, rather than a solution: In my Git Bash, following command hangs and I don't get the prompt back:

% python

So I just use:

% winpty python

As some people have noted above, you can also use:

% python -i

2020-07-14: Git 2.27.0 has added optional experimental support for pseudo consoles, which allow running Python from the command line: enter image description here

See attached session.enter image description here

Hopehopeful answered 5/3, 2020 at 15:19 Comment(0)
P
10

In addition to the answer of @Charles-Duffy, you can use winpty directly without installing/downloading anything extra. Just run winpty c:/Python27/python.exe. The utility winpty.exe can be found at Git\usr\bin. I'm using Git for Windows v2.7.1

The prebuilt binaries from @Charles-Duffy is version 0.1.1(according to the file name), while the included one is 0.2.2

Petronilapetronilla answered 8/2, 2016 at 22:26 Comment(0)
B
5

You can change target for Git Bash shortcut from:

"C:\Program Files\Git\git-bash.exe" --cd-to-home 

to

"C:\Program Files\Git\git-cmd.exe" --no-cd --command=usr/bin/bash.exe -l -i

This is the way ConEmu used to start git bash (version 16). Recent version starts it normally and it's how I got there...

Bradleigh answered 14/1, 2018 at 6:39 Comment(2)
This worked for me 👍. Worth noting what the bash.exe arguments do? man page says -l: Make bash act as if it had been invoked as a login shell, -i: If the -i options is present, the shell is interactiveFluffy
I used to have ConEmu working fine without winpty a while ago and I completely forgot what I did. Thanks this worked just the way it was before!Amphibious
O
5

type: 'winpty python' and it will work

gitbash has some issues when running any command that starts with python. this goes for any python manage.py commands as well. Always start with 'winpty python manage.py' At least this is what works for me. Running Windows 10.

Ottoottoman answered 14/2, 2018 at 19:51 Comment(0)
B
4

Update: I just installed the latest Git for Windows seconds ago, and they now have a box to check to fix the winpty Python issue in Git Bash! See here:

enter image description here

I still recommend also doing the steps below, however:


Original, and probably more-reliable, answer:

Python doesn't work in Git Bash (it just hangs or freezes forever); and getting Linux hash-bangs to work in Windows

Note that when Git Bash freezes when I try to run Python, I can't kill it with Ctrl + C nor Ctrl + D. I have to close the Git Bash terminal to kill it. :(

For those of us coming to Windows from Linux, you're probably also used to calling python3 at the command line, and using a hash bang at the top of your Python files that looks like this:

#!/usr/bin/env python3

...so that you can just make the file executable with chmod +x my_script.py and then run it directly as ./my_script.py, instead of having to use python3 my_script.py.

So, let's fix all of the problems mentioned above.

Quick summary:

  1. Add these two aliases and this PATH fix to the bottom of your ~/.bashrc file so that you can run python or python3 interactively in Git Bash:

    alias python='winpty python'
    alias python3='winpty python'
    
    # set PATH so it includes user's private bin if it exists
    if [ -d "$HOME/bin" ] ; then
        PATH="$HOME/bin:$PATH"
    fi
    
  2. Add this ~/bin/python3 executable wrapper so that you can use your #!/usr/bin/env python3 hash bang in Python scripts:

    #!/usr/bin/env bash
    
    winpty python "$@"
    
  3. Close and re-open all Git Bash terminals, or call . ~/.bashrc inside each of them. Then:

    # ensure your aliases exist
    alias python   # expected output: `alias python='winpty python'`
    alias python3  # expected output: `alias python3='winpty python'`
    
    # ensure your `python3` executable exists
    which python3  # expected output: `/c/Users/myusername/bin/python3`
    
  4. Test:

    # Both of these open Python 3 interactively
    # - then type `exit()` to exit
    python
    python3
    

    For this hello_world.py script:

    #!/usr/bin/env python3
    
    print("Hello world.")
    

    The following all run it:

    # all 3 of these run `hello_world.py` in Python 3
    # 1. Windows style
    python hello_world.py 
    # 2. Linux style
    python3 hello_world.py 
    # 3. Hash-bang Linux style
    ./hello_world.py 
    

If that all made sense to you, and you did it all, you're done. Otherwise, read on for more details and information, including troubleshooting.

Details

Step 1: make python and python3 available interactively in the Git Bash terminal

First, to get both python and python3 to work interactively in your Git Bash terminal and not hang or freeze forever, run these commands:

# Add interactive `python` and `python3` aliases. 
# - NB: it is *not* a mistake that both aliases point to `python`. That is how
#   it is supposed to be!
echo -e "\n" >> ~/.bashrc
echo "alias python='winpty python'" >> ~/.bashrc
echo "alias python3='winpty python'" >> ~/.bashrc

This is the equivalent of creating a ~/.bashrc file and adding these aliases to the bottom of it:

alias python='winpty python'
alias python3='winpty python'

Now close and re-open your Git Bash terminals to bring in these changes.

You can now run python or python3 interactively in the Git Bash terminal. Yaaay! For why this is necessary to call python through winpty, see @VonC's answer here:

Winpty is a compatibility layer that allows you to run a Windows console application from a Linux terminal.

  • When you cross-compile a program for Windows from Linux, the resulting binary will be a Windows console application that can be run directly from a Linux terminal without the need for winpty.
  • However, if you build a program natively on Windows, the resulting binary will be a Windows GUI application that cannot be run from a Linux terminal.
    In order to run a Windows GUI application from a Linux terminal, you need to use winpty.

Step 2: make the #!/usr/bin/env python3 hash-bang work too

For this to work, we need to add a custom ~/bin/python3 executable Bash wrapper to our PATH.

Open your ~/.bashrc file and add this to the bottom of it to automatically add ~/bin to our path if that directory exists:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

Create the ~/bin dir:

mkdir -p ~/bin

Re-source your ~/.bashrc file, or close and re-open all Git Bash terminals. If you don't know what "source"ing means, read my answer here: What is the difference between source and export?.

. ~/.bashrc

Now create a file at path ~/bin/python3, and paste this into it. Save and close the file when done.

#!/usr/bin/env bash

winpty python "$@"

Ensure it is executable:

chmod +x ~/bin/python3

Now, create a test file. Create a file called hello_world.py, and paste the following into it:

#!/usr/bin/env python3

print("Hello world.")

Make the file executable, and run it directly:

# make it executable
chmod +x hello_world.py

# run it
./hello_world.py 

You'll see:

Hello world.

Done! You now have 3 ways to run this script!:

# 1. Windows style
python hello_world.py 

# 2. Linux style
python3 hello_world.py 

# 3. Hash-bang Linux style
./hello_world.py 

How does this all work?

Exactly how this all works is a little bit tricky.

First off, when you manually run python or python3 all alone to get an interactive session, or python hello_world.py or python3 hello_world.py to run a file, it accesses your Bash aliases defined in your ~/.bashrc file, and runs winpty python instead. This is required for the calls to work properly in Git Bash, for the reasons already explained in @VonC's answer here.

Bash aliases are only available when a user, such as yourself, directly runs an alias in the Git Bash terminal. They are not available to the system nor to any other process started by the system. So, when you run ./hello_world.py, the #!/usr/bin/env python3 hash-bang does not find and run your python3 alias. Rather, it finds and runs your ~/bin/python3 executable Bash wrapper instead, which also performs the Python call through winpty, as required.

Troubleshooting: various errors you may see if you don't do the above right

  1. Problem: Running python or python3 hangs forever in the Git Bash terminal

    Solution: You forgot to add the two aliases which call winpty python. Add them.

  2. Problem: Running python3 opens up the Microsoft Store and tries to install Python.

    Solution: You forgot to make the alias python3='winpty python' alias.

  3. Problem: Hash-bangs don't work. Running ./hello_world.py says:

    Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

    Solution: you forgot to create the ~/bin/python wrapper executable. If you have created it, ensure it is executable. If both of those things are done, ensure ~/bin is in your PATH. See above to add a code chunk to ~/.bashrc to do that.

  4. Problem: Hash-bangs don't work. Running ./hello_worl.py says:

    /usr/bin/env: ‘python3’: No such file or directory

    You have turned off your python.exe and python3.exe Windows "App execution aliases", as explained here, but you have not created the ~/bin/python wrapper executable.

    Solution: you forgot to create the ~/bin/python wrapper executable. If you have created it, ensure it is executable. If both of those things are done, ensure ~/bin is in your PATH. See above to add a code chunk to ~/.bashrc to do that.

  5. Problem: you get this:

    `winpty: error: cannot start '"C:/Program Files/WindowsApps/Microsoft.DesktopAppInstaller_1.20.1881.0_x64__8wekyb3d8bbwe/AppInstallerPythonRedirector.exe"': Access is denied. (error 0x5)

    Solution:

    Honestly I can't remember how I got this error now, but it was one of my many errors I stumbled upon until I figured out my solutions explained in my answer above.

Other references

  1. I learned about the alias python='winpty python.exe' alias in @Vitaliy Terziev's answer here.
    1. winpty is also recommended by MSYS2 (the makers of the underlying system that Git Bash uses) at the bottom of this page here: https://www.msys2.org/wiki/Terminals/

See also

  1. My answer: Change the location of the ~ directory in a Windows install of Git Bash
Bespread answered 17/8, 2023 at 3:17 Comment(1)
Nice explanation. Upvoted. And Git 2.42 for Windows is just around the corner.Anatomist
B
2

In addition to @Vitaliy Terziev answer

try touch .bash_profile and then add alias into the file.

Berkeley answered 11/1, 2018 at 6:46 Comment(2)
I used .bashrc, but when I opened Git Bash, I got a warning message that bashrc exists w/o a .bash_profile. I renamed .bashrc to .bash_profile and now the warning went away. Thanks.Edelweiss
.bashrc vs .bash_profileJacquelyn
P
1

I am using MINGW64 via Visual Studio Code on Windows 10 and trying to install node-sass (which requires python2). I followed felixrieseberg/windows-build-tools #56 on Github which solved my issue.

This is a special case, but I'm posting in case someone has the same problem:

npm --add-python-to-path='true' --debug install --global windows-build-tools

This installs python and other required build tools to %USERPROFILE%\.windows-build-tools\python27.

Persis answered 24/7, 2018 at 17:35 Comment(0)
F
1

For python version 3.7.3 in vscode with gitbash as the default terminal I was dealing with this for a while and then followed @Vitaliy Terziev advice of adding the alias to .bashrc but with the following specification:

alias python=’“/c/Users/my user name/AppData/Local/Programs/Python/Python37/python.exe”’

Notice the combination of single and double quotes because of “my user name” spaces.

For me, "winpty" couldn't resolve python path in vscode.

Fretted answered 21/5, 2019 at 14:57 Comment(0)
S
1

Type the command PY instead of Python. Invoking the Interpreter (python.org).

Snakeroot answered 27/4, 2020 at 0:37 Comment(0)
S
1

I know this is an old post, but I just came across this problem on Windows 10 running Python 3.8.5 and Git 2.28.0.windows.1

Somehow I had several different 2.7x versions of Python installed as well. I removed every version of Python (3x and 2x), downloaded the official installer here, installed 3.8.5 fresh (just used the defaults) which installed Python 3.8.5 at this location:

C:\Users\(my username)\AppData\Local\Programs\Python\Python38

Then to get the command python to work in my git bash shell, I had to manually add the path to Python38 to my path variable following the instructions listed here. This is important to note because on the python installer at the bottom of the first modal that comes up it asks if you want to add the python path to your PATH environment variable. I clicked the checkbox next to this but it didn't actually add the path, hence the need to manually add the path to my PATH environment variable.

Now using my gitbash shell I can browse to a directory with a python script in it and just type python theScriptName.py and it runs no problem.

I wanted to post this because this is all I had to do to get my gitbash shell to allow me to run python scripts. I think there might have been some updates so I didn't need to do any of the other solutions listed here. At any rate, this is another thing to try if you are having issues running python scripts in your gitbash shell on a Windows 10 machine.

Enjoy.

Streeto answered 16/8, 2020 at 19:33 Comment(2)
Try to run python without script specified in the REPL mode.Imaginative
The latest installer has an option to add it to PATH.Atticism
J
0

Another example of this issue is using the AWS Elastic Beanstalk command line interface (awsebcli, eb cli) from the git bash (MINGW64, Mintty) in windows (using git version 2.19.0.windows.1).

I'm just posting this because it took me a while to end up here, searching for eb-cli specific issues.

Commands such as eb init or eb config save, which require user input, appear to cause a freeze/hang. In reality I guess the console is not updated with the text requesting user input. Moreover, eb deploy only updates the console text after the command has finished, so I don't get to see progress updates until finished.

As mentioned in the git for windows release notes (for v2.19.0) and e.g. in Xun Yang's answer, a workaround is to run

winpty eb <command> (instead of just eb <command>)

A alternative, as suggested in this git for windows issue, could be to use the windows native console instead of mintty (option during git installation).

Jacquelyn answered 19/9, 2018 at 14:8 Comment(0)
K
0

The one worked for me is as mentioned earlier in these great answers above is the alias as follows: (I'm using anaconda, so first find where is the python path, then add it into the alias on git bash). 1. on anaconda terminal I run: where python 2. on git bash I run: alias python='winpty "C:\ProgramData\Anaconda3\envs\your_env_name\python.exe"' 3. Done. Python is defined inside the git Bash using the alias.

Thanks to (Vitaliy Terziev & hygull) for their very helpful answers.

Kinin answered 29/10, 2019 at 22:48 Comment(0)
B
0
  1. python.exe -i works but got issues in exiting from the interactive mode by sending "^Z" (CTRL+Z). So, seem better to use winpty python.exe in Git Bash for Windows.

  2. Use ~/bin directory to make a wrap/reference file (like ~/bin/python) which will be accessible everywhere (you may use different version reference like ~/bin/python37).
    Code inside the file:

#!/usr/bin/env bash
# maybe declare env vars here like
# export PYTHONHOME=/c/Users/%USERNAME%/.python/Python36
# export PATH="${PATH}:/c/Users/%USERNAME%/.python/Python36"

# replace %USERNAME%,
# or use "~" instead of "/c/Users/%USERNAME%" if it works
winpty /c/Users/%USERNAME%/.python/Python36/python.exe ${@}

I just don't like these "magic" aliases which you're always forgetting where it's coming from, and sometimes leads to issues in some cases.

  1. Use ~/bin/python file and -i parameter:
#!/usr/bin/env bash
if [ -z "${@}" ]; then
    # empty args, use interactive mode
    /c/Users/%USERNAME%/.python/Python36/python.exe -i
else
    /c/Users/%USERNAME%/.python/Python36/python.exe ${@}
fi
Bridgettbridgette answered 22/1, 2020 at 13:6 Comment(1)
19480756 [sig] bash 2740! sigpacket::process: Suppressing signal 18 to win32 process (pid 14820) — response example after sending ^Z with interactive mode ran by python.exe -iBridgettbridgette
F
0

if you run a Windows PowerShell command and an error occurs, the error record will be appended to the “automatic variable” named $error.

You can use the $error variable to find the errors, in the same PowerShell session.

The $Error variable holds a collection of information, and that’s why using $Error[0] can get to your error message objects. Also the $Error[0] variable will hold the last error message encountered until the PowerShell session ends.

Flagstaff answered 19/10, 2020 at 9:42 Comment(1)
could you expand your answer? or perhaps add an example?Betoken
C
-3

Have a look at this answer:

Git Bash won't run my python files?

the path in Git Bash should be set like this:

PATH=$PATH:/c/Python27/
Caliph answered 15/9, 2015 at 23:25 Comment(2)
Actually... no! I can reproduce the OP's problem, and python is found in the PATH without issues. See sourceforge.net/p/msys2/tickets/32Aurar
OP's post suggests that the PATH isn't the problem.Gaskin

© 2022 - 2024 — McMap. All rights reserved.