Re: Winpdb-reborn anomalies - workaround

2021-05-18 Thread Dick Holmes
In article , encore1
@cox.net says...
> 
> I'm attempting to run winpdb-reborn, version 2.0.0.1, under MinGW. My 
> first problem is that if I enter winpdb  in the directory 
> containing , winpdb can't find rpdb2.py. I assume this is due 
> to some path problem, but I don't know how to fix it.
> 
> My second problem occurs when I run winpdb from the 
> /c/Python39/Lib/site-packages directory. The program runs correctly as 
> far as I can tell, but it writes about 20-30 lines of what looks like 
> debug information to the rpdb2 console window. The ourput starts with a 
> get_namespace() call. It does this 
> after each debug action (step over, step into, etc.) I haven't been able 
> to find any way to turn off this output.
> 
> Any suggestions greatly appreciated!
> 
> Dick

I found the code that forces debug info to be printed. The tests against 
the debug flag were commented out so debug info was written 
unconditionally. In case someone needs it, the file is rpdb/utils.py; 
look for fDebug.

This doesn't fix the path problem, but I can live with that.

Dick
-- 
https://mail.python.org/mailman/listinfo/python-list


Winpdb-reborn anomalies

2021-05-18 Thread Dick Holmes
I'm attempting to run winpdb-reborn, version 2.0.0.1, under MinGW. My 
first problem is that if I enter winpdb  in the directory 
containing , winpdb can't find rpdb2.py. I assume this is due 
to some path problem, but I don't know how to fix it.

My second problem occurs when I run winpdb from the 
/c/Python39/Lib/site-packages directory. The program runs correctly as 
far as I can tell, but it writes about 20-30 lines of what looks like 
debug information to the rpdb2 console window. The ourput starts with a 
get_namespace() call. It does this 
after each debug action (step over, step into, etc.) I haven't been able 
to find any way to turn off this output.

Any suggestions greatly appreciated!

Dick


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Subprocess Popen confusion

2020-05-18 Thread Dick Holmes
In article , 
__pete...@web.de says...
> 
> Dick Holmes wrote:
> 
> > https://occovid19.ochealthinfo.com/coronavirus-in-oc 
> 
> > I'm trying to
> > communicate using a continuing dialog between two
> > processes on the same system.
> 
> I think pexpect
> 
> https://pexpect.readthedocs.io/en/stable/index.html
> 
> does this naturally, but I don't know if Windows support is sufficient for 
> your needs.
> 
> > I've looked at various mechanisms and the
> > class that seems to fit my needs is Popen in the subprocess module, but
> > I can't seem to get more than a single round-trip message through Popen.
> > I first call Popen then poll using the identifier returned from the call
> > and the poll seems to work. I then call the communicate function passing
> > None as the value to send to the companion process stdin. I get the
> > expected result, but I also get "Exception condition detected on fd 0
> > \\n" and "error detected on stdin\\n". Subsequent attempts to
> > read/write/communicate with the subprocess fail because the file (stdxx
> > PIPE) is closed.
> > 
> > I can't tell from the documentation if the communicate function is a
> > one-time operation. 
> 
> Yes, communicate() is one-off, 
> 
> 
> """Interact with process: Send data to stdin and close it.
> Read data from stdout and stderr, until end-of-file is
> reached.  Wait for process to terminate.
> ...
> """
> 
> seems pretty clear. What would you improve?
> 
> > I have tried using read but the read call doesn't
> > return (I'm using winpdb-reborn to monitor the operations).
> 
> Try readline(). Deadlocks may happen ;)
>  
> > I'm using Python 3.7, Windows 10, winpdb-reborn 2.0.0, rpdb2 1.5.0. If
> > it makes any difference, I'm trying to communicate with GDB using the MI
> > interpreter.
> > 

Per Peter's suggestion I tried readline and it works "as expected". I 
also discovered that the reason the read operations were stalling was 
that they followed a write and the write doesn't actually occur until 
"flush" is called even though the function call returns. There are 
undoubtedly some subtleties lurking about, but at least I'm making good 
progress.

Thanks for the help!

Dick


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Subprocess Popen confusion

2020-05-14 Thread Dick Holmes
In article , 
__pete...@web.de says...
> 
> Dick Holmes wrote:
> 
> > https://occovid19.ochealthinfo.com/coronavirus-in-oc 
> 
> > I'm trying to
> > communicate using a continuing dialog between two
> > processes on the same system.
> 
> I think pexpect
> 
> https://pexpect.readthedocs.io/en/stable/index.html
> 
> does this naturally, but I don't know if Windows support is sufficient for 
> your needs.
> 
> > I've looked at various mechanisms and the
> > class that seems to fit my needs is Popen in the subprocess module, but
> > I can't seem to get more than a single round-trip message through Popen.
> > I first call Popen then poll using the identifier returned from the call
> > and the poll seems to work. I then call the communicate function passing
> > None as the value to send to the companion process stdin. I get the
> > expected result, but I also get "Exception condition detected on fd 0
> > \\n" and "error detected on stdin\\n". Subsequent attempts to
> > read/write/communicate with the subprocess fail because the file (stdxx
> > PIPE) is closed.
> > 
> > I can't tell from the documentation if the communicate function is a
> > one-time operation. 
> 
> Yes, communicate() is one-off, 
> 
> 
> """Interact with process: Send data to stdin and close it.
> Read data from stdout and stderr, until end-of-file is
> reached.  Wait for process to terminate.
> ...
> """
> 
> seems pretty clear. What would you improve?

Peter - thanks for the clarification. I'm using the 3.6.5 CHM 
documentation and it doesn't mention the phrase "and close it".
> 
> > I have tried using read but the read call doesn't
> > return (I'm using winpdb-reborn to monitor the operations).
> 
> Try readline(). Deadlocks may happen ;)
>  
> > I'm using Python 3.7, Windows 10, winpdb-reborn 2.0.0, rpdb2 1.5.0. If
> > it makes any difference, I'm trying to communicate with GDB using the MI
> > interpreter.
> > 


-- 
https://mail.python.org/mailman/listinfo/python-list


Subprocess Popen confusion

2020-05-13 Thread Dick Holmes
https://occovid19.ochealthinfo.com/coronavirus-in-oc I'm trying to 
communicate using a continuing dialog between two 
processes on the same system. I've looked at various mechanisms and the 
class that seems to fit my needs is Popen in the subprocess module, but 
I can't seem to get more than a single round-trip message through Popen. 
I first call Popen then poll using the identifier returned from the call 
and the poll seems to work. I then call the communicate function passing 
None as the value to send to the companion process stdin. I get the 
expected result, but I also get "Exception condition detected on fd 0
\\n" and "error detected on stdin\\n". Subsequent attempts to 
read/write/communicate with the subprocess fail because the file (stdxx 
PIPE) is closed.

I can't tell from the documentation if the communicate function is a 
one-time operation. I have tried using read but the read call doesn't 
return (I'm using winpdb-reborn to monitor the operations). 

I'm using Python 3.7, Windows 10, winpdb-reborn 2.0.0, rpdb2 1.5.0. If 
it makes any difference, I'm trying to communicate with GDB using the MI 
interpreter.

Thoughts and advice appreciated!

Dick
-- 
https://mail.python.org/mailman/listinfo/python-list


Installing tkinter on FreeBSD

2017-10-23 Thread Dick Holmes
I am trying to use tkinter on a FreeBSD system but the installed 
versions of Python (2.7 and 3.6) don't have thinter configured. I tried 
to download the source (no binaries available for FreeBSD) and build a 
new version of Python but the build reported that it couldn't install 
_tkinter. Despite this report, Python works for non-tkinter 
applications. Is there a magical formula for configuring tkinter during 
or after a build??

TIA!

--
Dick Holmes

-- 
https://mail.python.org/mailman/listinfo/python-list


Interacting with Subprocesses

2016-05-04 Thread Dick Holmes
I am attempting to write a Python program that will interact with
a (non-Python) process. The programs will run under MinGW. The
process can use stdin/stdout commands and responses and can work 
with pipes. The problem I'm having is that I can't find any
way in Python to have a continuing dialog with the process. I
have tried Popen communicate, but that protocol seems to be
limited to a single message/response pair, and the response
is not returned to the message originator until the process
terminates. Unfortunately I don't have access to the process'
source code so I can't change the communication medium.

Is there some feature that will allow me to initiate the process
and execute multiple message/response pairs between the Python
program and the process during a single execution of the process?

Thanks!

Dick


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tk MouseWheel Support

2011-03-11 Thread Dick Holmes
On Thu, 10 Mar 2011 21:56:52 +0100, Alexander Kapps
alex.ka...@web.de wrote:

snip
Can you post your code please (if it's too long, strip it down to 
the smallest program which still shows the problem.)

First, thanks to MRAB for showing me how to get the wheel working.

In the following code (Windows only), rolling the wheel doesn't invoke
the event method. If I change the mouse wheel binding to
self.master.bind... the event gets called and the scrolling works.
Note that the scrolling occurs even when the mouse is outside the
listbox. I guess I'll have to look at the mouse position when I enter
the wheel_event method to see if the mouse is over the listbox.

# mouse wheel in listbox
import Tkinter as tk

class Application(tk.Frame):
def __init__(self, master=None):
tk.Frame.__init__(self, master)
self.grid()

self.button = tk.Button(self, text='Button')
self.button.grid(row=0, column=0)

self.yscroll = tk.Scrollbar(self, orient=tk.VERTICAL)
self.yscroll.grid(row=1, column=1, sticky=tk.N+tk.S)
self.list = tk.Listbox(self, selectmode=tk.SINGLE, width=40,
height=5,
yscrollcommand=self.yscroll.set)
self.list.grid(row=1, column=0, sticky=tk.N+tk.S+tk.E+tk.W)
self.yscroll[command] = self.list.yview
self.list.bind(MouseWheel, self.wheel_event)
for i in xrange(10):
self.list.insert(tk.END, 'line ' + str(i))

def wheel_event(self, evt):
lines = evt.delta // 120
self.list.yview_scroll(-lines, tk.UNITS)

root = tk.Tk()
root.geometry('300x300+400+200')
root.title('  Wheel Test')
app = Application(master = root)
root.mainloop()

-- 
http://mail.python.org/mailman/listinfo/python-list