After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 614249 - Connection refused when importing ldtp module
Connection refused when importing ldtp module
Status: RESOLVED FIXED
Product: LDTP
Classification: Other
Component: ldtp2
2.0.0
Other Linux
: Normal normal
: ---
Assigned To: Nagappan Alagappan
LDTP Development Mailing List
Depends on:
Blocks:
 
 
Reported: 2010-03-29 13:08 UTC by Ara Pulido
Modified: 2010-09-28 20:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch to fix the issue (1.06 KB, patch)
2010-03-30 02:18 UTC, Nagappan Alagappan
committed Details | Review
Update ldtpd to send a signal to ldtp when it's ready for requests (3.98 KB, patch)
2010-03-31 15:53 UTC, James Tatum
rejected Details | Review
Minor update to above patch (4.02 KB, patch)
2010-03-31 17:40 UTC, James Tatum
committed Details | Review

Description Ara Pulido 2010-03-29 13:08:35 UTC
In Ubuntu 10.04, when I import ldtp module, I get a connection refused error. After two or three attempts the module is correctly imported.

This is happening with ldtp 2.0.4, but it was happening with 2.0.3 as well.
In [1]: import ldtp

** (-c:4829): WARNING **: Trying to register gtype 'WnckWindowState' as enum when in fact it is of type 'GFlags'

** (-c:4829): WARNING **: Trying to register gtype 'WnckWindowActions' as enum when in fact it is of type 'GFlags'

** (-c:4829): WARNING **: Trying to register gtype 'WnckWindowMoveResizeMask' as enum when in fact it is of type 'GFlags'
---------------------------------------------------------------------------
error                                     Traceback (most recent call last)

/home/ara/curro/mago/trunk2/<ipython console> in <module>()

/usr/lib/pymodules/python2.6/ldtp/__init__.py in <module>()
    255     return None
    256 
--> 257 _populateNamespace(globals())
    258 _pollEvents = PollEvents()
    259 thread.start_new_thread(_pollEvents.run, ())

/usr/lib/pymodules/python2.6/ldtp/__init__.py in _populateNamespace(d)
     58 
     59 def _populateNamespace(d):
---> 60     for method in client._client.system.listMethods():
     61         if method.startswith('system.'):
     62             continue

/usr/lib/python2.6/xmlrpclib.pyc in __call__(self, *args)
   1197         return _Method(self.__send, "%s.%s" % (self.__name, name))
   1198     def __call__(self, *args):
-> 1199         return self.__send(self.__name, args)
   1200 
   1201 ##


/usr/lib/python2.6/xmlrpclib.pyc in __request(self, methodname, params)
   1487             self.__handler,
   1488             request,
-> 1489             verbose=self.__verbose
   1490             )
   1491 

/usr/lib/pymodules/python2.6/ldtp/client.pyc in request(self, host, handler, request_body, verbose)
     59                 # Retry connecting again

     60                 return xmlrpclib.Transport.request(
---> 61                     self, host, handler, request_body, verbose=0)
     62             raise
     63         except xmlrpclib.Fault, e:

/usr/lib/python2.6/xmlrpclib.pyc in request(self, host, handler, request_body, verbose)
   1233         self.send_host(h, host)
   1234         self.send_user_agent(h)
-> 1235         self.send_content(h, request_body)
   1236 
   1237         errcode, errmsg, headers = h.getreply()

/usr/lib/python2.6/xmlrpclib.pyc in send_content(self, connection, request_body)
   1347         connection.putheader("Content-Type", "text/xml")
   1348         connection.putheader("Content-Length", str(len(request_body)))
-> 1349         connection.endheaders()
   1350         if request_body:
   1351             connection.send(request_body)

/usr/lib/python2.6/httplib.pyc in endheaders(self)
    902             raise CannotSendHeader()
    903 
--> 904         self._send_output()
    905 
    906     def request(self, method, url, body=None, headers={}):

/usr/lib/python2.6/httplib.pyc in _send_output(self)
    774         msg = "\r\n".join(self._buffer)
    775         del self._buffer[:]
--> 776         self.send(msg)
    777 
    778     def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0):

/usr/lib/python2.6/httplib.pyc in send(self, str)
    733         if self.sock is None:
    734             if self.auto_open:
--> 735                 self.connect()
    736             else:
    737                 raise NotConnected()

/usr/lib/python2.6/httplib.pyc in connect(self)
    714         """Connect to the host and port specified in __init__."""
    715         self.sock = socket.create_connection((self.host,self.port),
--> 716                                              self.timeout)
    717 
    718         if self._tunnel_host:

/usr/lib/python2.6/socket.pyc in create_connection(address, timeout)
    510         except error, msg:
    511             if sock is not None:
    512                 sock.close()
    513 
--> 514     raise error, msg

error: [Errno 111] Connection refused
Comment 1 Ara Pulido 2010-03-29 13:32:38 UTC
I am afraid to add that with ldtp 2.0.4 and latest updates in Lucid, the connection refused error always happen.
Comment 2 Nagappan Alagappan 2010-03-30 02:18:51 UTC
Created attachment 157432 [details] [review]
Proposed patch to fix the issue

Ara, could you please try this in Ubuntu 10.04 ? I tried and this worked fine for me.
Comment 3 James Tatum 2010-03-30 03:20:22 UTC
Review of attachment 157432 [details] [review]:

Applied the patch. It seems to work for me with no adverse effects. Of course, the real test will be Ara's system as I have not been able to reproduce this bug.
Comment 4 Nagappan Alagappan 2010-03-30 06:48:45 UTC
As per discussion with Ara over IRC, the attached patch fixes the issue, committing to git head
Comment 5 James Tatum 2010-03-31 15:53:43 UTC
Created attachment 157604 [details] [review]
Update ldtpd to send a signal to ldtp when it's ready for requests

On a fast system, this will actually slightly speed up the startup time associated with "import ldtp" - from 3 seconds to a little over 1 second. On a slower system, the attached patch will wait for up to 15 seconds for the daemon to report that it is ready to service requests. If the daemon doesn't send the ready signal, it will try anyway after 15 seconds and throw the exception (if any).
Comment 6 James Tatum 2010-03-31 17:40:59 UTC
Created attachment 157620 [details] [review]
Minor update to above patch
Comment 7 Nagappan Alagappan 2010-03-31 22:47:24 UTC
Eitan, are you okay with the above patch ?
Comment 8 Nagappan Alagappan 2010-04-06 22:30:24 UTC
Review of attachment 157604 [details] [review]:

As James Tatum next patch is approved
Comment 9 Nagappan Alagappan 2010-04-06 22:30:43 UTC
Review of attachment 157620 [details] [review]:

James, thanks for the patch
Comment 10 Nagappan Alagappan 2010-04-06 22:31:16 UTC
Committed in git
Comment 11 rahmanmostafizur 2010-09-27 19:37:45 UTC
Today I installed ldtp in Ubuntu 10.04 Lucid. I received the following things
when I tried to work with LDTP

~$python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from ldtp import*

** (-c:18128): WARNING **: Trying to register gtype 'WnckWindowState' as enum when in fact it is of type 'GFlags'

** (-c:18128): WARNING **: Trying to register gtype 'WnckWindowActions' as enum when in fact it is of type 'GFlags'

** (-c:18128): WARNING **: Trying to register gtype 'WnckWindowMoveResizeMask' as enum when in fact it is of type 'GFlags'

Can you please fix this problem?

-Mostafiz
Comment 12 James Tatum 2010-09-27 20:06:10 UTC
There is nothing to fix. Those warnings are innocuous.
Comment 13 rahmanmostafizur 2010-09-27 21:29:59 UTC
Today I installed ldtp in Ubuntu 10.04 Lucid. I received the following things
when I tried to work with LDTP

~$python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from ldtp import*

** (-c:18128): WARNING **: Trying to register gtype 'WnckWindowState' as enum when in fact it is of type 'GFlags'

** (-c:18128): WARNING **: Trying to register gtype 'WnckWindowActions' as enum when in fact it is of type 'GFlags'

** (-c:18128): WARNING **: Trying to register gtype 'WnckWindowMoveResizeMask' as enum when in fact it is of type 'GFlags'

Can you please fix this problem?

-Mostafiz
Comment 14 rahmanmostafizur 2010-09-27 21:35:48 UTC
Sorry for resubmitting the same comment as comment 13. I opened "gedit". I wrote the following commands

~$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from ldtp import*

** (-c:18128): WARNING **: Trying to register gtype 'WnckWindowState' as enum when in fact it is of type 'GFlags'

** (-c:18128): WARNING **: Trying to register gtype 'WnckWindowActions' as enum when in fact it is of type 'GFlags'

** (-c:18128): WARNING **: Trying to register gtype 'WnckWindowMoveResizeMask' as enum when in fact it is of type 'GFlags'
>>> guiexist ('frm*-gedit')
0
>>>

According to the LDTP tutorial the command "guiexist ('frm*-gedit')" should return 1. I do not know what bug is causing this problem. Can you please look into the matter?

Thanks

-Mostafiz
Comment 15 rahmanmostafizur 2010-09-27 21:49:11 UTC
Sorry for resubmitting the same comment as comment 13. I opened "gedit". I wrote the following commands

~$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from ldtp import*

** (-c:18128): WARNING **: Trying to register gtype 'WnckWindowState' as enum when in fact it is of type 'GFlags'

** (-c:18128): WARNING **: Trying to register gtype 'WnckWindowActions' as enum when in fact it is of type 'GFlags'

** (-c:18128): WARNING **: Trying to register gtype 'WnckWindowMoveResizeMask' as enum when in fact it is of type 'GFlags'
>>> guiexist ('frm*-gedit')
0
>>>

According to the LDTP tutorial the command "guiexist ('frm*-gedit')" should return 1. I do not know what bug is causing this problem. Can you please look into the matter?

Thanks

-Mostafiz
Comment 16 Nagappan Alagappan 2010-09-27 23:08:48 UTC
Can you please try:

getwindowlist()

and report ? Guess this is a different issue, rather than the current bug. Request to create new bug, if required.

Have you enabled accessibility ?

Thanks
Comment 17 rahmanmostafizur 2010-09-28 15:01:04 UTC
Thank you Nagappan. Enabling accessibility solves my problem with the command "guiexist ('frm*-gedit')". getWindowList() works perfectly. I hope that the three warning messages will not create problem for me.

Regards

-Mostafiz
Comment 18 rahmanmostafizur 2010-09-28 20:23:40 UTC
Now, I have a problem for ldtp in Ubuntu 8.04. I installed ldtp and python-ldtp using "apt-get install" command. getapplist() command works without any exception. However, getwindowlist() throws exception

>>>getwindowlist()
Traceback (most recent call last):
  • File "<stdin>", line 1 in <module>
  • File "/var/lib/python-support/python2.5/ldtp.py", line 3445 in getwindowlist
    raise ldtpExecutionError(str (msg))
ldtp.LdtpExecutionError: "u 'getwindowlist failed: Application map not initialized'"

Comment 19 Nagappan Alagappan 2010-09-28 20:31:54 UTC
Hello Rahman,

On Ubuntu 8.04, it's based on LDTPv1. Uninstall LDTP version, you have installed from Ubuntu repository, get the LDTPv1 source from git repository, compile and install it and see how it works !

http://ldtp.freedesktop.org/wiki/GIT

Thanks
Comment 20 James Tatum 2010-09-28 20:57:24 UTC
Mostafiz,

This is a bug report. This is not the place to get support. Please stop posting support requests here.

Please use the mailing list or IRC:

http://ldtp.freedesktop.org/wiki/Mailing_list/IRC