Visualize Data with Python > 2. Python for Data Analysis --> Crazy exceptions in event loop errors!

Hello!

I am doing the Visualize data with Python course, and have just started working in the Dos prompt using IPython. I am running Windows 10 (x64). I am not using conda as I had already installed Python (3.8).

https://www.codecademy.com/paths/visualize-data-with-python/tracks/python-for-data-analysis-dvp/modules/lists-cumulative-project-dvp/articles/how-to-use-ipython

The output from my initial attempts at this lesson is below (apologies for my clumsy start!).

As you can see I am getting A LOT of “Unhandled exception in event loop:” – three times in six lines.

I’ve Googled this and come across this page on GitHub. It sounds like it’s a bug and there’s nothing I can do?

This can’t be right, and is certainly no way to code.

Can anyone suggest a) what the frack is going on here and b) if there’s anything I can do about it?

Many thanks,
Rachel

In [2]: print (x)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-2-606ad02f996c> in <module>
----> 1 print (x)

NameError: name 'x' is not defined


Unhandled exception in event loop:
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\asyncio\proactor_events.py", line 768, in _loop_self_reading
    f.result()  # may raise
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\asyncio\windows_events.py", line 808, in _poll
    value = callback(transferred, key, ov)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\asyncio\windows_events.py", line 457, in finish_recv
    raise ConnectionResetError(*exc.args)

Exception [WinError 995] The I/O operation has been aborted because of either a thread exit or an application request
Press ENTER to continue...

In [3]: x=10

In [4]: for x in range(10):
   ...:     print (x)
   ...:
0
1
2
3
4
5
6
7
8
9

In [5]: str.capitalize?
Signature: str.capitalize(self, /)
Docstring:
Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower
case.
Type:      method_descriptor


Unhandled exception in event loop:
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\asyncio\proactor_events.py", line 768, in _loop_self_reading
    f.result()  # may raise
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\asyncio\windows_events.py", line 808, in _poll
    value = callback(transferred, key, ov)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\asyncio\windows_events.py", line 457, in finish_recv
    raise ConnectionResetError(*exc.args)

Exception [WinError 995] The I/O operation has been aborted because of either a thread exit or an application request
Press ENTER to continue...
In [6]: jupyter notebook
  File "<ipython-input-6-ba6c65dc902f>", line 1
    jupyter notebook
            ^
SyntaxError: invalid syntax


In [7]: install jupyter
  File "<ipython-input-7-38f0dc4a9df7>", line 1
    install jupyter
            ^
SyntaxError: invalid syntax



Unhandled exception in event loop:
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\asyncio\proactor_events.py", line 768, in _loop_self_reading
    f.result()  # may raise
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\asyncio\windows_events.py", line 808, in _poll
    value = callback(transferred, key, ov)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\asyncio\windows_events.py", line 457, in finish_recv
    raise ConnectionResetError(*exc.args)

Exception [WinError 995] The I/O operation has been aborted because of either a thread exit or an application request
Press ENTER to continue...

Hmm the errors aren’t something I’ve come across before. Perhaps installing Python through some other route would be the best option, or at least the least hassle, if you can’t find a straightforward solution.

The command to run a jupyter notebook should be run in the shell itself, not an ipython session which goes for any pip install <package> commands and so on which would explain the syntax errors at least.

A quick google of that specific error led me to this- https://stackoverflow.com/a/59376929
If you were determined to fix it you know the packages to aim for at least. Either that or installing a slightly older version of IPython might save you some trouble. It’s a question of how much time and effort you’re willing to spend on it.