Ipython Ctypes conflict

W

Wanderer

When I try to use program that uses ctypes to load a dll in Ipython. I
get

Traceback (most recent call last):
File "... \console.py" line 671, in hook_wrapper_23
res = ensire_str(readline_hook(prompt))
File "...\rlmain.py", lin 342, in readline
return self.mode.readline(prompt)
File "...\emac.py", line 116, in readline
self._print_prompt()
File "...\rlmain.py, line 298, in _print_prompt
n = c.write_scrolling(self.prompt, self.prompt_color)
File "...\console.py", line 289, in write_scrolling
w, h = self.size()
TypeError: 'NoneType' object is not iterable
Readline internal error

Some hacking in console.py shows it is caused by

def size(self, width=None, height=None):
u'''Set/get window size.'''
info = CONSOLE_SCREEN_BUFFER_INFO()
status = self.GetConsoleScreenBufferInfo(self.hout,
byref(info))
if not status:
return None
if width is not None and height is not None:
wmin = info.srWindow.Right - info.srWindow.Left + 1
hmin = info.srWindow.Bottom - info.srWindow.Top + 1
#print wmin, hmin
width = max(width, wmin)
height = max(height, hmin)
#print width, height
self.SetConsoleScreenBufferSize(self.hout,
self.fixcoord(width,
height))
else:
return (info.dwSize.X, info.dwSize.Y)

After loading the dll, GetConsoleScreenBufferInfo always returns zero,
so size returns None and everybody is unhappy.

I don't get the problem in Idle or WinPython.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top