Reputation: 34
I installed the windows-curses library through pip, and it seemed to install without any issue.
However whenever I try to run a program like this simple one below in gives me this error.
Code:
import curses
import time
stdscr = curses.initscr()
time.sleep(10)
curses.endwin()
Error:
Traceback (most recent call last):
File "C:/Users/elija/OneDrive/Desktop/ASCII_Adventure/temp2.py", line 4, in <module>
stdscr = curses.initscr()
File "C:\Users\elija\AppData\Local\Programs\Python\Python312\Lib\curses\__init__.py", line 30, in initscr
fd=_sys.__stdout__.fileno())
AttributeError: 'NoneType' object has no attribute 'fileno'
I am using python 3.12.1 on Window 10 64bit The windows-curses version is 2.3.2 (Latest version at this time)
I've tried running the code in IDLE, Command Prompt, and Power Shell, all with the same result.
I also tried running this code to try and debug the issue, but I had the same error.
import curses
import os # Import os for compatibility check
# Compatibility Checks for Curses
try:
# Initialize curses using windows-curses
stdscr = curses.initscr()
except Exception as e:
print(f"Error during curses initialization: {e}")
# If initialization fails, exit the script
exit(1)
# Check if the terminal supports colors
if not curses.has_colors() or not curses.can_change_color():
print("Terminal lacks color support")
# Exit the script if colors are not supported
exit(1)
# End curses
curses.endwin()
Upvotes: 1
Views: 196