Open darikg opened 9 years ago
Thanks for reporting! I have no immediate idea what's going on, but I'll have a look at this as soon as possible.
Hi, I was just trying on Windows, but with Python 3.4 I can't reproduce it.
It seems that the windll.kernel32.GetConsoleScreenBufferInfo
API call fails.
If it helps, I can confirm there's two different issues with python 3.3 and 3.4. In 3.3 I get the error message I listed above, and in 3.4, I get simply "failed to create process." printed to console.
Oddly enough, even though ptpython fails in 3.3, ptipython works (Although it still needs control-enter to execute a line). With 3.4, both ptpython and ptipython print 'failed to create process'
If you want to hear something completely bananas, ptpython in python 3.3 works if you set prompt_toolkit.terminal.win32_input._DEBUG_RENDER_OUTPUT to True
Mapping \x0d
to Keys.ControlJ instead of ControlM fixes the new line issue
Okay, that sounds like there are a couple of bugs. Thanks for keeping me up to date. I haven't been able to fix anything lately, but I hope to restart prompt-toolkit development very soon again.
Totally wasn't my intention to try to rush you or anything!! I'm just having fun poking around blindly and keeping notes here
Hi @darikg,
Can we close this issue? Windows development progressed a lot, but I'm not sure whether this still happens or not.
Yeah close it!
On Wed, Jul 15, 2015 at 7:24 AM, Jonathan Slenders <notifications@github.com
wrote:
Hi @darikg https://github.com/darikg,
Can we close this issue? Windows development progressed a lot, but I'm not sure whether this still happens or not.
— Reply to this email directly or view it on GitHub https://github.com/jonathanslenders/python-prompt-toolkit/issues/86#issuecomment-121586028 .
Same bug for win64 (windows 8.1) python2.7 prompt_toolkit-0.45 when using mycli-1.2.
Traceback (most recent call last):
File "C:\Python27\Scripts\mycli-script.py", line 9, in <module>
load_entry_point('mycli==1.2.0', 'console_scripts', 'mycli')()
File "C:\Python27\lib\site-packages\click\core.py", line 664, in __call__
return self.main(*args, **kwargs)
File "C:\Python27\lib\site-packages\click\core.py", line 644, in main
rv = self.invoke(ctx)
File "C:\Python27\lib\site-packages\click\core.py", line 837, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Python27\lib\site-packages\click\core.py", line 464, in invoke
return callback(*args, **kwargs)
File "C:\Python27\lib\site-packages\mycli\main.py", line 550, in cli
mycli.run_cli()
File "C:\Python27\lib\site-packages\mycli\main.py", line 311, in run_cli
document = cli.run()
File "C:\Python27\lib\site-packages\prompt_toolkit\interface.py", line 272, in
run
self._redraw()
File "C:\Python27\lib\site-packages\prompt_toolkit\interface.py", line 244, in
_redraw
is_done=self.is_done)
File "C:\Python27\lib\site-packages\prompt_toolkit\renderer.py", line 339, in
render
style=style,
File "C:\Python27\lib\site-packages\prompt_toolkit\renderer.py", line 159, in
output_screen_diff
current_pos = move_cursor(Point(y=y, x=c))
File "C:\Python27\lib\site-packages\prompt_toolkit\renderer.py", line 76, in m
ove_cursor
_output_cursor_forward(new.x)
File "C:\Python27\lib\site-packages\prompt_toolkit\terminal\win32_output.py",
line 187, in cursor_forward
sr = self._screen_buffer_info().dwCursorPosition
AttributeError: 'NoneType' object has no attribute 'dwCursorPosition'
@itsnotvalid Does this still happen? If so, is it reproducible, or just from time to time? Can you tell me which version of Windows you have and which Python version (also 64 or 32bit)?
Yes - still happens on Windows 7 Pro 64 bit, Python 2.7.10 32 bit, when doing a 'pip install ptpython'
10 ~/prog/ptpython: pip freeze Pygments==2.0.2 docopt==0.6.2 jedi==0.9.0 prompt-toolkit==0.52 ptpython==0.24 six==1.10.0 wcwidth==0.1.5
9 ~/prog/ptpython: ptpython
Traceback (most recent call last):
File "C:\Python27\Lib\runpy.py", line 162, in _run_module_as_main
"main", fname, loader, pkg_name)
File "C:\Python27\Lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Users\KDahlhausen\prog\ptpython\env\Scripts\ptpython.exemain.py", line 9, in
I get the error with the simplest example:
from __future__ import unicode_literals
from prompt_toolkit import prompt
if __name__ == '__main__':
answer = prompt('Give me some input: ')
print('You said: %s' % answer)
On Windows 10, 64bit, with the latest Anaconda (Python 2.7) installed (I installed python-prompt-toolkit
through the anaconda.org repository link). (I don't mind switching to Python 3.5 though :+1: )
Windows 10 64bit Python 3.4.3 x86
Hi everyone, a lot of improvements regarding Windows were done in the last couple of months. Now that IPython uses prompt_toolkit, many smaller bugs have been fixed as well.
I think the windows issues in this ticket are all solved. Please let me know if this is not the case.
Get Screen Buffer Error: handler:152 GetLastError():6
I have get NoConsoleScreenBuffer exception too, and i print the windll.kernel32.GetLastError() result get 6 return code. this meat "invalid windows handler"
I have a possible fix: jonathanslenders/python-prompt-toolkit@d5d9e29
Can you please upgrade to the latest prompt_toolkit master, and see whether it works? So far, I really still don't understand what's going on. It seems to happen on 64bit builds of Python only.
In python 2.7: Need to press meta+enter to execute a line even when multiline mode is off
In python 3.3: Fails with traceback: