Gobnius
Gobnius

Reputation: 65

I get an Error 6 with Asciimatics and Python

I am learning how to use asciimatics with Python. When I try to run the following code:

from asciimatics.screen import Screen
from time import sleep

def demo(screen):
    screen.print_at('Hello world!', 0, 0)
    screen.refresh()
    sleep(10)

Screen.wrapper(demo)

I get this error:

Traceback (most recent call last):
  File "C:\Users\Patrick\Pictures\Python\Westhope\2.0\test.py", line 20, in <module>
    Screen.wrapper(demo)
  File "C:\Python27\lib\asciimatics\screen.py", line 1336, in wrapper
    unicode_aware=unicode_aware)
  File "C:\Python27\lib\asciimatics\screen.py", line 1245, in open
None))
error: (6, 'CreateFile', 'The handle is invalid.')

Upvotes: 1

Views: 222

Answers (1)

Peter Brittain
Peter Brittain

Reputation: 13619

The short answer is that you are not running in a proper console/terminal window and you need to run inside the standard Windows command prompt instead.

See https://asciimatics.readthedocs.io/en/latest/troubleshooting.html#i-can-t-run-it-inside-pycharm-or-other-ides for more details.

Upvotes: 2

Related Questions