Failure to debug my script

I’m on Windows machine running Python in Git Bash
$ python --version
Python 3.11.0
I have an issue to run my simple script in debugger but it runs fine when I simply execute it.
Here’s my script:

import datetime

current_date ="%Y-%m-%d")


If I run it I have this:

If I run it in debugger I have this:

$ python -m pdb
> c:\ev\sandbox\<module>()
-> import datetime
(Pdb) b 6
Breakpoint 1 at c:\ev\sandbox\
(Pdb) c
Traceback (most recent call last):
  File "", line 1768, in main
  File "", line 1646, in _run
  File "", line 597, in run
  File "<string>", line 1, in <module>
  File "C:\EV\SandBox\", line 2, in <module>
    import datetime
ModuleNotFoundError: No module named 'datetime'
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> c:\ev\sandbox\<module>()
-> import datetime

Hence, I can't run my script in debugger.
How could I fix it?
I checked that modur 'datetime' is built-in and worked outside of debugger. 


I have some update:
I used another Windows machine. I could use it only for testing. I used again Git Bash:

$ python3 --version
Python 3.11.5

I ran same script in debugger with no issue:

$ python3 -m pdb 
> \\\landingzonebos\zzemptyzz\ev\<module>()
-> import datetime
(Pdb) b 5
Breakpoint 1 at \\\landingzonebos\zzemptyzz\ev\
(Pdb) c
> \\\landingzonebos\zzemptyzz\ev\<module>()
-> print(current_date)
(Pdb) s

Hence, the issue is definitely in my environment … but I have to use this particular machine. How could I fix it?

datetime is a built in module from the standard library. I’d say reinstall python as something is wrong.

Hi @csm10495
I like your idea of re-installing python.
Well … in my case I use Azure Data Studio on Windows server. I installed Git Bash and use shell for all my needs. I see that Git Bash has also python … and I tried to use it … but as you see … it has an issue.
I don’t know how to unisntall python from Git Bash.
Maybe I would better install a new python application and put it in a path?
What python would you recommend me to install on Windows 2019?

I realized that my server already has Anaconda installed.
It’s Python 3.10.9
I tried and it worked fine with my script.
Now I need only somehow make Anaconda default python on my machine.
Thanks for advice