Found out about Curses a couple days ago and wanted to start messing around with it to see what I could create. I followed some instructions for installation on another thread and it installed just fine. However, when I attempt to run initscr() (which initializes the screen, it crashes)
Here's the Error text:
{Traceback (most recent call last):
File "C:\Users\ADimi\Desktop\Wing Workspace\test.py", line 2, in <module>
stdscr = curses.initscr()
File "C:\Users\ADimi\AppData\Local\Programs\Python\Python37\lib\curses\__init__.py", line 30, in initscr
fd=_sys.__stdout__.fileno())
AttributeError: 'NoneType' object has no attribute 'fileno'
}
To recreate:
You can run this in either, idle or a seperate file. For me this directly causes the error, specficially line 2. stdscr = curses.initscr()
import curses
stdscr = curses.initscr()
From what I'm understanding from the error itself, _sys.__stdout__
is returning a NoneType and thus leading to a crash.
I tried to find similar issues online and have had no luck. Any help at this point could help out a lot I'd love to get this working.
Here's a link about curses: https://docs.python.org/2/howto/curses.html#curses-howto
Here's where I found out about curses, the first comment is the installation instructions I followed: What is needed for curses in Python 3.4 on Windows7?
Thanks in advance.
EDIT: I have some what found a fix. There is a windows tailored version of curses found here: https://pypi.org/project/windows-curses/#files
After uninstalling the old curses and installing this you must follow some intermediate steps:
Create a file with this test code:
import curses
import time
screen = curses.initscr()
screen.clear()
time.sleep(4)
Create a path for 'python' for your cmd prompt: https://www.pythoncentral.io/add-python-to-path-python-is-not-recognized-as-an-internal-or-external-command/
Now using the cmd prompt open the file:
python test.py
You should be presented with a black screen for 4 seconds, then it will close.
This is the only work around I've come across, I will keep searching and updating as I go thank you.