Spyder and VS Code issue with Python

Viewed 343

I have this weird issue on Spyder and also VS Code. I am complete beginner to python langauge and our teacher have recomended us to use Spyder IDE as it is begnnier friendly and it could run code in cells. Now, the issue I have with spyder is our teacher have given us a pre-written code and when I try to run it. It would not run kind of. here is the code

# -StartPython.py *- coding: utf-8 -*-
"""
Spyder Editor

#%% starts a new cell. Use second green triangle to run just the cell that
your mouse has last clicked in (or Ctrl-Enter on a PC or Command-Return on a
Macintosh or Menu>Run>Run Cell)
"""

#%%

def hello():

    print("Hello, world!")

#%%

def myname():

    print("My name is Bill")

And when I try to run the first cell i.e

 #%%

def hello():

    print("Hello, world!")  

I get this in the console

it seems the debugger cannot resolve D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\ntpath.py
This may make the debugger miss breakpoints in the standard library.
Related bug: https://bugs.python.org/issue1180193

Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 7.29.0 -- An enhanced Interactive Python.

runcell(1, 'F:/virtualUniversity/Languages/Python/1st_program/_62a42c7a6447d06e53ea5693a9685b69_StartPython.py')

now the funny thing is when I remove def hello(): the code would run without any problems. same thing happens with VS code too. what am I doing wrong?? Is there some setting I have turn on or something?? oh and I forgot I have already installed anaconda.

0 Answers
Related