Open igor-egorov opened 5 years ago
Can you please share your environment details. @igor-egorov
Same here, Python 3.7.1 64 bits on win10, clean virtualenv
I will check this, been off coding for two months.
I was getting the same error. You fixed the source of the error on May 28, 2019 (https://github.com/CITGuru/PyInquirer/commit/9e9efaa13b05925bb055d4aacdee55945717e930), but the latest release on PyPi is from 2018. The error goes away if I change the offending line. I ended up just git cloning the latest commit and installing it from the local folder.
Same here. I get the error with the PyPI version of PyInquirer under Python 3.7.
Instead of @nesadi approach, you can also just pass a Validator into the 'validate' key...
from PyInquirer import prompt, Validator, ValidationError
...
class ValidateEditor(Validator):
def validate(self, document):
if document.text and len(document.text.split('\n')) <= 1:
raise ValidationError(
message='Must be at least 1 line', cursor_position=len(document.text))
...
def askPaste():
questions = [
{
'name': 'content',
'type': 'editor',
'message': 'Opening editor',
# lambda text: len(text.split('\n')) >= 1 or 'Must be at least 1 line',
'validate': ValidateEditor,
'eargs': {
'editor': 'default',
'ext': '.tmp'
},
},
]
return prompt(questions)
@CITGuru Could we please get a new release to PyPi that includes 9e9efaa1 ? Many uses of the editor
prompt are broken otherwise. Thanks!
PyInquirer/examples/editor.py does not work :(
Python 3.7.1 PyInquirer==1.0.3