npcole / npyscreen

Automatically exported from code.google.com/p/npyscreen
Other
479 stars 109 forks source link

npyscreen dosen't work #116

Open SergeyYaroslawzew opened 3 years ago

SergeyYaroslawzew commented 3 years ago

Hello. I'm using Python 3.8.3 and Windows 10, but I can't run this program:

import npyscreen class MyForm(npyscreen.FormBaseNew): def create(self):

BoxTitle used multiline

    obj = self.add(npyscreen.BoxTitle, name="test", custom_highlighting=True, values=["first line", "second line"])
    color1 = self.theme_manager.findPair(self, 'DANGER')
    color2 = self.theme_manager.findPair(self, 'IMPORTANT')
    obj.entry_widget.highlighting_arr_color_data = [[color1,color1,color2],[color2,color1,color2,color2]]

class App(npyscreen.StandardApp): def onStart(self): self.addForm("MAIN", MyForm)

obj = App() obj.run()

========================================RESULTS===================================== Traceback (most recent call last): File "C:\Program Files\Python38\lib\site-packages\npyscreen\apNPSApplicationEvents.py", line 16, in get yield self.interal_queue.pop() IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Program Files\Python38\lib\site-packages\npyscreen\apNPSApplicationEvents.py", line 18, in get raise StopIteration StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "c:/Users/Хозяин/Desktop/PyProgect/Programms/for_tests.py", line 19, in obj.run() File "C:\Program Files\Python38\lib\site-packages\npyscreen\apNPSApplication.py", line 30, in run return npyssafewrapper.wrapper(self.remove_argument_call_main) File "C:\Program Files\Python38\lib\site-packages\npyscreen\npyssafewrapper.py", line 41, in wrapper wrapper_no_fork(call_function) File "C:\Program Files\Python38\lib\site-packages\npyscreen\npyssafewrapper.py", line 97, in wrapper_no_fork return_code = call_function(_SCREEN) File "C:\Program Files\Python38\lib\site-packages\npyscreen\apNPSApplication.py", line 25, in __remove_argument_call_main return self.main() File "C:\Program Files\Python38\lib\site-packages\npyscreen\apNPSApplicationManaged.py", line 172, in main self._THISFORM.edit() File "C:\Program Files\Python38\lib\site-packages\npyscreen\fm_form_edit_loop.py", line 47, in edit self.edit_loop() File "C:\Program Files\Python38\lib\site-packages\npyscreen\fm_form_edit_loop.py", line 38, in edit_loop self._widgets[self.editw].edit() File "C:\Program Files\Python38\lib\site-packages\npyscreen\wgboxwidget.py", line 150, in edit self.entry_widget.edit() File "C:\Program Files\Python38\lib\site-packages\npyscreen\wgmultiline.py", line 581, in edit self.get_and_use_key_press() File "C:\Program Files\Python38\lib\site-packages\npyscreen\wgwidget.py", line 575, in get_and_use_key_press return self.try_while_waiting() File "C:\Program Files\Python38\lib\site-packages\npyscreen\wgwidget.py", line 560, in try_while_waiting self.parent.parentApp._internal_while_waiting() File "C:\Program Files\Python38\lib\site-packages\npyscreen\apNPSApplicationEvents.py", line 41, in _internal_while_waiting self.process_event_queues(max_events_per_queue=self.max_events_per_queue) File "C:\Program Files\Python38\lib\site-packages\npyscreen\apNPSApplicationEvents.py", line 51, in process_event_queues for event in queue.get(maximum=max_events_per_queue): RuntimeError: generator raised StopIteration

Etzeitet commented 3 years ago

The latest release on PyPI doesn't work on versions above 3.6 (possibly 3.7).

According to this issue #108 there have been commits to allow npyscreen to run on 3.8, those changes just haven't been pushed to a new version on PyPI. The same issue has a workaround.

It would seem this project doesn't get any love anymore!

dsoprea commented 3 years ago

Might explain why the example results in a basic ncurses initialization problem in 3.8.

Example:

MyForm = Form()

usrn_box = MyForm.add_widget(TitleText, name="Your name:")
internet = MyForm.add_widget(TitleText, name="Your favourite internet page:")

MyForm.edit()

# usrn_box.value and internet.value now hold the user's answers.

Exception:

Traceback (most recent call last):
  File "/home/dustin/.virtualenvs/npyscreen_project/bin/bootstrap", line 7, in <module>
    exec(compile(f.read(), __file__, 'exec'))
  File "/home/dustin/development/npyscreen_project/product_extractor/oboce/resources/scripts/bootstrap", line 109, in <module>
    _main()
  File "/home/dustin/development/npyscreen_project/product_extractor/oboce/resources/scripts/bootstrap", line 54, in _main
    MyForm = npyscreen.Form()
  File "/home/dustin/.virtualenvs/npyscreen_project/lib/python3.9/site-packages/npyscreen/fmForm.py", line 37, in __init__
    super(_FormBase, self).__init__(*args, **keywords)
  File "/home/dustin/.virtualenvs/npyscreen_project/lib/python3.9/site-packages/npyscreen/proto_fm_screen_area.py", line 76, in __init__
    self.theme_manager = ThemeManagers.ThemeManager()
  File "/home/dustin/.virtualenvs/npyscreen_project/lib/python3.9/site-packages/npyscreen/npysThemeManagers.py", line 70, in __init__
    self.define_colour_numbers()
  File "/home/dustin/.virtualenvs/npyscreen_project/lib/python3.9/site-packages/npyscreen/npysThemeManagers.py", line 86, in define_colour_numbers
    if curses.can_change_color():
_curses.error: must call initscr() first