[Python-projects] PyQonsole as a Widget

Chad Brantly chadsjunkmail at mac.com
Tue Mar 20 22:19:36 CET 2007


On Mar 9, 2007, at 6:53 AM, Sylvain Thénault wrote:

> On Thursday 08 March à 14:03, Chad Brantly wrote:
>>
>> On Mar 7, 2007, at 3:48 AM, Sylvain Thénault wrote:
>>
>>> On Tuesday 06 March à 13:49, chadsjunkmail at mac.com wrote:
>>>> I did a little more investigation.  See my results below:
>>
>>>>> 2) When we close down a shell, we get the following "Bad file
>>>>> descriptor" error:
>>>>>
>>>>>>  File "/usr/pkg/lib/python2.4/site-packages/pyqonsole/
>>>>>> procctrl.py", line 203,
>>>>>> in slotDoHousekeeping
>>>>>>    process.processHasExited(status)
>>>>>>  File "/usr/pkg/lib/python2.4/site-packages/pyqonsole/pty_.py",
>>>>>> line 285, in
>>>>>> processHasExited
>>>>>>    self.commClose()
>>>>>>  File "/usr/pkg/lib/python2.4/site-packages/pyqonsole/pty_.py",
>>>>>> line 328, in
>>>>>> commClose
>>>>>>    fcntl(self.out[0], F_SETFL, os.O_NONBLOCK)
>>>>>> IOError: [Errno 9] Bad file descriptor
>>>>>> QSocketNotifier: invalid socket 6 and type 'Read', disabling...
>>>>
>>>> Similarly, it appears that the code is trying to flush a file that
>>>> does not exist.  Should there be a check to make sure the file  
>>>> exists
>>>> before trying to flush it?
>>>
>>> hum, this one sound weird. Don't you have a little test case
>>> demonstrating the problem ?
>>
>> Yes...If you just run pyqonsole and type exit in the shell you will
>> see the same error.  It seems like it isn't flushing properly when
>> you exit a shell.  Also, is there a way to pass a signal from
>> pyqonsole back to Qt when someone exits a shell?  Our consoles are
>> embedded in a QTabWidget, and we would like to close that tab when a
>> user exits the shell.  If needed, I could write a little test case to
>> demonstrate what we want.
>
> actually I can't reproduce this. Which platform are you using ? A test
> case would be welcome anyway.

I posted an example called embedTest.py at http:// 
www.thelostserver.com/embedTest.py.  It is a simple tabbed console.   
On NetBSD, when we type "exit" in any of the consoles, we get the  
"Bad file descriptor" error.

On Mac OS X we can't get it to load at all.  It starts to load and  
then just hangs.  We then tried running your pyqonsole example and  
got the following error:

> mac27.build: ~ {152} /usr/pkg/bin/pyqonsole
> no shell specified. Using /bin/tcsh
> Traceback (most recent call last):
>   File "/usr/pkg/bin/pyqonsole", line 6, in ?
>     run()
>   File "/usr/pkg/lib/python2.4/site-packages/pyqonsole/main.py",  
> line 126, in run
>     main(sys.argv)
>   File "/usr/pkg/lib/python2.4/site-packages/pyqonsole/main.py",  
> line 92, in main
>     session.run()
>   File "/usr/pkg/lib/python2.4/site-packages/pyqonsole/session.py",  
> line 98, in run
>     self.sh.setWriteable(False)
>   File "/usr/pkg/lib/python2.4/site-packages/pyqonsole/pty_.py",  
> line 156, in setWriteable
>     os.chmod(ttyname, mode)
> OSError: [Errno 1] Operation not permitted: '/dev/ttyp3'

Do you know of anyone that has pyqonsole running on a Mac or Windows  
machine?

-Chad



More information about the Python-Projects mailing list