Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got "expected LP_CONSOLE_SCREEN_BUFFER_INFO instance instead of pointer to CONSOLE_SCREEN_BUFFER_INFO" on Windows10 #13601

Open
jxcangel opened this issue Mar 23, 2022 · 3 comments
Labels

Comments

@jxcangel
Copy link

jxcangel commented Mar 23, 2022

Issue

While run ipython on Windows10 and execute my own script, I got this error:

# Just ignore run_debug.py script because it is okay for run "python run_debug.py" directly
# The issue only occurred in ipython interpreter
run d:/CodeStation/watf/bin/run_debug.py d:/tmp/waf_mts_access_control.params.yaml
Traceback (most recent call last):
  File "C:\Users\jonjiang\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\jonjiang\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\jonjiang\AppData\Local\Programs\Python\Python310\Scripts\ipython.exe\__main__.py", line 7, in <module>
    sys.exit(start_ipython())
  File "C:\Users\jonjiang\AppData\Roaming\Python\Python310\site-packages\IPython\__init__.py", line 123, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "C:\Users\jonjiang\AppData\Roaming\Python\Python310\site-packages\traitlets\config\application.py", line 846, in launch_instance
    app.start()
  File "C:\Users\jonjiang\AppData\Roaming\Python\Python310\site-packages\IPython\terminal\ipapp.py", line 318, in start
    self.shell.mainloop()
  File "C:\Users\jonjiang\AppData\Roaming\Python\Python310\site-packages\IPython\terminal\interactiveshell.py", line 653, in mainloop
    self.interact()
  File "C:\Users\jonjiang\AppData\Roaming\Python\Python310\site-packages\IPython\terminal\interactiveshell.py", line 638, in interact
    code = self.prompt_for_code()
  File "C:\Users\jonjiang\AppData\Roaming\Python\Python310\site-packages\IPython\terminal\interactiveshell.py", line 576, in prompt_for_code
    text = self.pt_app.prompt(
  File "C:\Users\jonjiang\AppData\Local\Programs\Python\Python310\lib\site-packages\prompt_toolkit\shortcuts\prompt.py", line 1033, in prompt
    return self.app.run(
  File "C:\Users\jonjiang\AppData\Local\Programs\Python\Python310\lib\site-packages\prompt_toolkit\application\application.py", line 937, in run
    return loop.run_until_complete(
  File "C:\Users\jonjiang\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete
    return future.result()
  File "C:\Users\jonjiang\AppData\Local\Programs\Python\Python310\lib\site-packages\prompt_toolkit\application\application.py", line 856, in run_async
    return await _run_async2()
  File "C:\Users\jonjiang\AppData\Local\Programs\Python\Python310\lib\site-packages\prompt_toolkit\application\application.py", line 826, in _run_async2
    result = await _run_async()
  File "C:\Users\jonjiang\AppData\Local\Programs\Python\Python310\lib\site-packages\prompt_toolkit\application\application.py", line 746, in _run_async
    self._request_absolute_cursor_position()
  File "C:\Users\jonjiang\AppData\Local\Programs\Python\Python310\lib\site-packages\prompt_toolkit\application\application.py", line 1149, in _request_absolute_cursor_position
    self.renderer.request_absolute_cursor_position()
  File "C:\Users\jonjiang\AppData\Local\Programs\Python\Python310\lib\site-packages\prompt_toolkit\renderer.py", line 486, in request_absolute_cursor_position
    self._min_available_height = self.output.get_rows_below_cursor_position()
  File "C:\Users\jonjiang\AppData\Local\Programs\Python\Python310\lib\site-packages\prompt_toolkit\output\win32.py", line 385, in get_rows_below_cursor_position
    info = self.get_win32_screen_buffer_info()
  File "C:\Users\jonjiang\AppData\Local\Programs\Python\Python310\lib\site-packages\prompt_toolkit\output\win32.py", line 204, in get_win32_screen_buffer_info
    success = windll.kernel32.GetConsoleScreenBufferInfo(
ctypes.ArgumentError: argument 2: <class 'TypeError'>: expected LP_CONSOLE_SCREEN_BUFFER_INFO instance instead of pointer to CONSOLE_SCREEN_BUFFER_INFO

If you suspect this is an IPython 8.1.1 bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@python.org

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    %config Application.verbose_crash=True

Environment

Windows

# OS is Chinese Edition, I translate Chinese character to English
Version	Windows 10 Home Edition
Release	21H2
Install Date	‎2021-‎12-‎06
OS Internal Version	19044.1586
Experience	Windows Feature Experience Pack 120.2212.4170.0

Python && IPython && prompt_tool

Python 3.10.3 (tags/v3.10.3:a342a49, Mar 16 2022, 13:07:40) [MSC v.1929 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.1.1 -- An enhanced Interactive Python. Type '?' for help.

Related packages:

PS C:\Users\jonjiang> python -m pip install --upgrade ipython
Requirement already satisfied: ipython in c:\users\jonjiang\appdata\local\programs\python\python310\lib\site-packages (8.1.1)
Requirement already satisfied: decorator in c:\users\jonjiang\appdata\roaming\python\python310\site-packages (from ipython) (5.1.1)
Requirement already satisfied: colorama in c:\users\jonjiang\appdata\roaming\python\python310\site-packages (from ipython) (0.4.4)
Requirement already satisfied: stack-data in c:\users\jonjiang\appdata\roaming\python\python310\site-packages (from ipython) (0.2.0)
Requirement already satisfied: setuptools>=18.5 in c:\users\jonjiang\appdata\local\programs\python\python310\lib\site-packages (from ipython) (58.1.0)
Requirement already satisfied: pygments>=2.4.0 in c:\users\jonjiang\appdata\roaming\python\python310\site-packages (from ipython) (2.11.2)
Requirement already satisfied: matplotlib-inline in c:\users\jonjiang\appdata\roaming\python\python310\site-packages (from ipython) (0.1.3)
Requirement already satisfied: backcall in c:\users\jonjiang\appdata\roaming\python\python310\site-packages (from ipython) (0.2.0)
Requirement already satisfied: jedi>=0.16 in c:\users\jonjiang\appdata\roaming\python\python310\site-packages (from ipython) (0.18.1)
Requirement already satisfied: traitlets>=5 in c:\users\jonjiang\appdata\roaming\python\python310\site-packages (from ipython) (5.1.1)
Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in c:\users\jonjiang\appdata\local\programs\python\python310\lib\site-packages (from ipython) (3.0.28)
Requirement already satisfied: pickleshare in c:\users\jonjiang\appdata\roaming\python\python310\site-packages (from ipython) (0.7.5)
Requirement already satisfied: parso<0.9.0,>=0.8.0 in c:\users\jonjiang\appdata\roaming\python\python310\site-packages (from jedi>=0.16->ipython) (0.8.3)
Requirement already satisfied: wcwidth in c:\users\jonjiang\appdata\roaming\python\python310\site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython) (0.2.5)
Requirement already satisfied: pure-eval in c:\users\jonjiang\appdata\roaming\python\python310\site-packages (from stack-data->ipython) (0.2.2)
Requirement already satisfied: executing in c:\users\jonjiang\appdata\roaming\python\python310\site-packages (from stack-data->ipython) (0.8.3)
Requirement already satisfied: asttokens in c:\users\jonjiang\appdata\roaming\python\python310\site-packages (from stack-data->ipython) (2.0.5)
Requirement already satisfied: six in c:\users\jonjiang\appdata\roaming\python\python310\site-packages (from asttokens->stack-data->ipython) (1.16.0)

Reproduce

I tried to find this issue in google, several person said downgrade prompt_toolkit to previous version, I do it, and do it more that not only downgrade prompt_toolkit, but also ipython. I tried below versions for IPython and prompt_toolkit, but all have same issue:

IPython 7.9.0
IPython 7.6.0

and tried use python 3.9.9 interpreter as well, it crash same as 3.10.3
So I tried to run my script (run_debug.py) on Debian 10, it is ok. The issue only shown on Win10 (whatever have or not have administrator permission)

Maybe this is a prompt_toolkit issue? I am not sure but need ipython team have a look.

@jxcangel
Copy link
Author

This issue appeared on these Win10 versions:

  • 20H2.19042.1586
  • 21H1.19043.1586
  • 21H2.19044.1586

@MrMino
Copy link
Member

MrMino commented Mar 23, 2022

Yes, this looks like an issue with prompt_toolkit specific to your OS. The code in question seems pretty common. Could you please post it on their issue tracker?

@MrMino MrMino added the windows label Mar 23, 2022
@jxcangel
Copy link
Author

sure, I'll post this issue to prompt_toolkit, thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants