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

 
 

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

Submitted by:  ts <timotheus25>
Submitted on:  Wed 25 Oct 2006 12:52:42 AM UTC  
 
Category: pluginsSeverity: 3 - Normal
Item Group: displayStatus: Wont Fix
Privacy: PublicAssigned to: Emmanuel Bouthenot <kolter>
Originator Name: Open/Closed: Closed
Release: NoneIRC nick: 

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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 MemberIn charge of this item.
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 File(s):
   
   
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

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 5 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Thu 02 Nov 2006 04:49:21 PM UTCtimotheus25Attached File-=>Added weechat_ncurses_workaround_example_1.txt, #11141
Sat 28 Oct 2006 07:46:04 PM UTCkolterStatusNone=>Wont Fix
  Assigned toNone=>kolter
  Open/ClosedOpen=>Closed
Wed 25 Oct 2006 12:52:42 AM UTCtimotheus25Attached File-=>Added foobar.py, #11059

Back to the top


Powered by Savane 3.1-cleanup1