-
Notifications
You must be signed in to change notification settings - Fork 6
Migrate pyinquirer to questionary fixes #42 #44
Conversation
When I try this on a directory without any config, and either prompt_toolkit 2.0.9 or 2.0.10 with questionary 1.4.0, I get an error > PYTHONPATH=~/projects/python/license.sh python3 ~/projects/python/license.sh/license-sh config
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/prompt_toolkit/cache.py", line 34, in get
return self._data[key]
KeyError: 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/jayvdb/projects/python/license.sh/license-sh", line 72, in <module>
config_cmd(path, config)
File "/home/jayvdb/projects/python/license.sh/license_sh/commands/__init__.py", line 69, in config_cmd
answers = questionary.prompt(questions)
File "/usr/lib/python3.7/site-packages/questionary/prompt.py", line 97, in prompt
answer = question.unsafe_ask(patch_stdout)
File "/usr/lib/python3.7/site-packages/questionary/question.py", line 59, in unsafe_ask
return self.application.run()
File "/usr/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 709, in run
return run()
File "/usr/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 683, in run
return f.result()
File "/usr/lib/python3.7/site-packages/prompt_toolkit/eventloop/future.py", line 149, in result
raise self._exception
File "/usr/lib/python3.7/site-packages/prompt_toolkit/eventloop/coroutine.py", line 90, in step_next
new_f = coroutine.throw(exc)
File "/usr/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 658, in _run_async2
result = yield f
File "/usr/lib/python3.7/site-packages/prompt_toolkit/eventloop/coroutine.py", line 86, in step_next
new_f = coroutine.send(None)
File "/usr/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 601, in _run_async
self._redraw()
File "/usr/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 444, in _redraw
self.renderer.render(self, self.layout)
File "/usr/lib/python3.7/site-packages/prompt_toolkit/renderer.py", line 546, in render
layout.container.preferred_height(size.columns, size.rows).preferred)
File "/usr/lib/python3.7/site-packages/prompt_toolkit/layout/containers.py", line 245, in preferred_height
for c in self._all_children]
File "/usr/lib/python3.7/site-packages/prompt_toolkit/layout/containers.py", line 245, in <listcomp>
for c in self._all_children]
File "/usr/lib/python3.7/site-packages/prompt_toolkit/layout/containers.py", line 2179, in preferred_height
return self.content.preferred_height(width, max_available_height)
File "/usr/lib/python3.7/site-packages/prompt_toolkit/layout/containers.py", line 1362, in preferred_height
dont_extend=self.dont_extend_height())
File "/usr/lib/python3.7/site-packages/prompt_toolkit/layout/containers.py", line 1380, in _merge_dimensions
preferred = get_preferred()
File "/usr/lib/python3.7/site-packages/prompt_toolkit/layout/containers.py", line 1357, in preferred_content_height
self.get_line_prefix)
File "/usr/lib/python3.7/site-packages/prompt_toolkit/layout/controls.py", line 308, in preferred_height
content = self.create_content(width, None)
File "/usr/lib/python3.7/site-packages/prompt_toolkit/layout/controls.py", line 313, in create_content
fragments_with_mouse_handlers = self._get_formatted_text_cached()
File "/usr/lib/python3.7/site-packages/prompt_toolkit/layout/controls.py", line 296, in _get_formatted_text_cached
lambda: to_formatted_text(self.text, self.style))
File "/usr/lib/python3.7/site-packages/prompt_toolkit/cache.py", line 37, in get
value = getter_func()
File "/usr/lib/python3.7/site-packages/prompt_toolkit/layout/controls.py", line 296, in <lambda>
lambda: to_formatted_text(self.text, self.style))
File "/usr/lib/python3.7/site-packages/prompt_toolkit/formatted_text/base.py", line 45, in to_formatted_text
return to_formatted_text(value(), style=style)
File "/usr/lib/python3.7/site-packages/questionary/prompts/common.py", line 306, in _get_choice_tokens
tokens.pop() # Remove last newline.
IndexError: pop from empty list Note I get a different error if no args are given > PYTHONPATH=~/projects/python/license.sh python3 ~/projects/python/license.sh/license-sh
Traceback (most recent call last):
File "/home/jayvdb/projects/python/license.sh/license-sh", line 102, in <module>
dep_tree, WHITELIST
File "/home/jayvdb/projects/python/license.sh/license-sh", line 50, in print_dependency_tree_with_licenses
dep_tree, whitelist=whitelist
File "/home/jayvdb/projects/python/license.sh/license_sh/helpers.py", line 91, in annotate_dep_tree
node.license_normalized = normalize_license_expression(node.license)
AttributeError: 'NoneType' object has no attribute 'license' |
@jayvdb I've tried the same way as you described on multiple projects and I can't reproduce. Could you please give me more info/hints on how I could reproduce this? Thanks 👏 |
are you testing in a project without any config? |
I wont get time to look at this today. IMO merge and ill keep investigating and report if/when I can get a reproducible. |
@jayvdb I did run without a config. I've also tried to install it globally to a system and run in a different directory with/without a config. I'll merge this and create a separate issue so that I can get back to it. Thanks for your help! |
Migrates Pyinquirer to questionary, related issue #42