bugWeeChat - Bugs: bug #18103, weechat display broken by python...

 
 

bug #18103: weechat display broken by python cmd.Cmd objects

Submitter:  ts <timotheus25>
Submitted:  Wed 25 Oct 2006 12:52:42 AM UTC
 
Category:  plugins Severity:  3 - Normal
Item Group:  display Status:  Wont Fix
Privacy:  Public Assigned to:  kolter
Originator Name:  Open/Closed:  Closed
Release:  * None IRC nick: 
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       No canned response available

 

Thu 02 Nov 2006 04:49:21 PM UTC, comment #2: 

Here is an example work-around for those who wish to use cmd.Cmd, or any other ncurses-linked Python module. Some modules conflict with WeeChat when loaded directly into the WeeChat python interpreter, including all of those that link to ncurses.

What you need to do is to execute the conflicting modules within a separate python interpreter instance, while maintaining the interface between WeeChat and the script. A typical method to accomplish this:

(1) all use of conflicting module(s) must run in stand-alone Python script(s) designated as SLAVE
(2) a WeeChat script that facilitates IRC commands, etc., and does not use conflicting modules, is designated as MASTER
(3) the MASTER script (1) executes and controls SLAVE script(s) (2) via some form of interprocess communication

One clean way to accomplish this is from MASTER to parse the WeeChat IRC command, and send the direct results to the subprocess as a single line, token-parsable by SLAVE.

User inputs '/cmd -g blah foo bar' in WeeChat. The MASTER writes to the SLAVE pipe 'CMD G blah foo bar', and then reads from the SLAVE pipe for how to proceed.

An obvious method for the MASTER--SLAVE communication is a bidirectional pipe using some form of 'popen2' or Popen from the Python library. Unfortunately, there are a plethora of caveats involved, including the fact that synchronous pipe communication will likely lockup even with Python 2.4.

To solve this, one can use asynchronous pipe communication. An example module for subclassing the Python 2.4 subprocess module:
'subproc2.py'
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440554

An example of a WeeChat script that uses this form of interprocess communication:
https://tstotts.net/pubvc/weechat-plugins/diatheke4IRC/

ts <timotheus25>
Sat 28 Oct 2006 07:46:04 PM UTC, comment #1: 

cmd module depends on libreadline which is in most unixes is linked with libncurses. It conflict with the libncurses used by weechat and it breaks display.

Emmanuel Bouthenot <kolter>
Project Member
Wed 25 Oct 2006 12:52:42 AM UTC, original submission:  

A simple script to break weechat display. Initializes a
cmd.Cmd object.

To see the effect, load this script.  Then try resizing your terminal. Watch weechat not adjust itself anymore.

ts <timotheus25>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #11141:  weechat_ncurses_workaround_example_1.txt added by timotheus25 (2KiB - text/plain - text of workaround example 1)
file #11059:  foobar.py added by timotheus25 (843B - application/x-python - script to break display refresh)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

 

 

 

Follow 5 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2006-11-02 timotheus25 Attached File- Added weechat_ncurses_workaround_example_1.txt, #11141
2006-10-28 kolter StatusNone Wont Fix
    Assigned toNone kolter
    Open/ClosedOpen Closed
2006-10-25 timotheus25 Attached File- Added foobar.py, #11059

Back to the top


Powered by Savane 3.9