Open schuellerf opened 4 years ago
In setup.py the version string is changed from "3.5.1" to "3.4.1". Is this change intentional? This could explain the discussion in #54
@Werni2A changing the version number was kind of intentional to mark that the API changed to work with my python 3 setup. I have no clue why I set it to 3.4.1 - I wanted to "update" the minor version ... I set it now to 3.6.0 although I'm not familiar with the LDTP2 release process and this is also not ment to be be a proper release. Just a note that this branch is not fully API compatible.
hi @schuellerf I test your patch, I find another 2 issue in python3: 1,
$ python ldtp-interface.py
/usr/lib/python3.9/site-packages/gi/overrides/Gtk.py:1649: Warning: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
return _Gtk_main(*args, **kwargs)
Traceback (most recent call last):
File "/home/test/ldtp-interface.py", line 6, in <module>
from ooldtp import *
File "/usr/local/lib/python3.9/site-packages/ldtp-3.6.0-py3.9.egg/ooldtp/__init__.py", line 33, in <module>
import thread
ModuleNotFoundError: No module named 'thread'
2,
$ python ldtp-interface.py
/usr/lib/python3.9/site-packages/gi/overrides/Gtk.py:1649: Warning: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
return _Gtk_main(*args, **kwargs)
Traceback (most recent call last):
File "/home/test/ldtp-interface.py", line 6, in <module>
from ooldtp import *
File "/usr/local/lib/python3.9/site-packages/ldtp-3.6.0-py3.9.egg/ooldtp/__init__.py", line 40, in <module>
import xmlrpclib
ModuleNotFoundError: No module named 'xmlrpclib'
After this patch, my test script works:
$ git diff
diff --git a/ooldtp/__init__.py b/ooldtp/__init__.py
index 75eedbf..13d0802 100644
--- a/ooldtp/__init__.py
+++ b/ooldtp/__init__.py
@@ -30,14 +30,14 @@ import types
import atexit
import signal
import socket
-import thread
+import _thread
import logging
import datetime
import platform
import tempfile
import warnings
import traceback
-import xmlrpclib
+import xmlrpc.client as xmlrpclib
import subprocess
from log import logger
from base64 import b64decode
hi @schuellerf I test your patch, I find another 2 issue in python3: 1,
$ python ldtp-interface.py
/usr/lib/python3.9/site-packages/gi/overrides/Gtk.py:1649: Warning: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
return _Gtk_main(*args, **kwargs)
Traceback (most recent call last):
File "/home/test/ldtp-interface.py", line 6, in <module>
from ooldtp import *
File "/usr/local/lib/python3.9/site-packages/ldtp-3.6.0-py3.9.egg/ooldtp/__init__.py", line 33, in <module>
import thread
ModuleNotFoundError: No module named 'thread'
2,
$ python ldtp-interface.py
/usr/lib/python3.9/site-packages/gi/overrides/Gtk.py:1649: Warning: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
return _Gtk_main(*args, **kwargs)
Traceback (most recent call last):
File "/home/test/ldtp-interface.py", line 6, in <module>
from ooldtp import *
File "/usr/local/lib/python3.9/site-packages/ldtp-3.6.0-py3.9.egg/ooldtp/__init__.py", line 40, in <module>
import xmlrpclib
ModuleNotFoundError: No module named 'xmlrpclib'
After this patch, my test script works:
$ git diff
diff --git a/ooldtp/__init__.py b/ooldtp/__init__.py
index 75eedbf..13d0802 100644
--- a/ooldtp/__init__.py
+++ b/ooldtp/__init__.py
@@ -30,14 +30,14 @@ import types
import atexit
import signal
import socket
-import thread
+import _thread
import logging
import datetime
import platform
import tempfile
import warnings
import traceback
-import xmlrpclib
+import xmlrpc.client as xmlrpclib
import subprocess
from log import logger
from base64 import b64decode
@nagappan, when could this be merged? Currently python 3 is not supported by ldtp.
@nagappan, any updates on this?
Having no luck getting this working with python 3.8.10
get the following whenever I try to import ldtp
Traceback (most recent call last):
File "LinuxDesktopFileSelection.py", line 20, in
Apologies if this is an LDTP noob issue
I was able to get the current code - apply all the fixes described in this thread - and then I was able to run a simple test. I am working on an Ubuntu 20.04 image on a Windows-10 Hyper-V VM on a small laptop. I used VS Code and Python 3.8.10. I have never contributed to anything on GitHub - if you want the code I have running, how do we/I proceed? There are some original changes that I made but most of it is the changes made by scheullerf and ikawada-zz
@jdhicks121350 usually you just fork the repository into your GitHub account, commit/push your changes there and finally also create a pullrequest to the original project or mine (or both 😅) that does not really matter in the end (thanks to git 😉)
When I use this branch on RHEL 9 with Python 3.9, LDTP daemon is not starting when I import ldtp
in Python prompt / script.
Following error is generated, client is unable to connect to server.
Command ldtp
is working fine on Terminal, issue is only with Python import.
>>> from ldtp import * Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.9/site-packages/ldtp-3.6.0-py3.9.egg/ldtp/__init__.py", line 594, in <module> _populateNamespace(globals()) File "/usr/local/lib/python3.9/site-packages/ldtp-3.6.0-py3.9.egg/ldtp/__init__.py", line 247, in _populateNamespace for method in client._client.system.listMethods(): File "/usr/lib64/python3.9/xmlrpc/client.py", line 1122, in __call__ return self.__send(self.__name, args) File "/usr/lib64/python3.9/xmlrpc/client.py", line 1464, in __request response = self.__transport.request( File "/usr/local/lib/python3.9/site-packages/ldtp-3.6.0-py3.9.egg/ldtp/client.py", line 156, in request h=self.send_request(host, handler, request_body, bool(verbose)) File "/usr/lib64/python3.9/xmlrpc/client.py", line 1291, in send_request self.send_content(connection, request_body) File "/usr/lib64/python3.9/xmlrpc/client.py", line 1321, in send_content connection.endheaders(request_body) File "/usr/lib64/python3.9/http/client.py", line 1280, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/lib64/python3.9/http/client.py", line 1040, in _send_output self.send(msg) File "/usr/lib64/python3.9/http/client.py", line 980, in send self.connect() File "/usr/lib64/python3.9/http/client.py", line 946, in connect self.sock = self._create_connection( File "/usr/lib64/python3.9/socket.py", line 844, in create_connection raise err File "/usr/lib64/python3.9/socket.py", line 832, in create_connection sock.connect(sa) OSError: [Errno 99] Cannot assign requested address
Didn't observe this issue with python2 version. Could you let us know what might be the issue ?
I'm having the exact problem since I moved from Ubuntu to openSUSE. I am now confused and have been trying to do exactly what you describe. I'm truing to run ldtp -s from a terminal and also using from ldtp import and none of the examples are now working for me at all. That is why I have not submitted my code - fearing I have created a bug. On my Ubuntu box I was easily able to manipulate the Calculator APP. On openSUSE I cant get past the first "from ldtp import " that one line just hangs like it started another process!
Also - I have tried 3.7.12, 3.8.7, 3.9.10 and 2 different versions of SUSE - nothing has made any difference. 10 days or more now...
It seems that the socket code cannot use the address/port combo. Is there a reservation for that address/port or another process already running there? Look in the client code and print the address and port that is being used – you could also hard code an address in that same code to see if it can use a different address/port.
Maybe a firewall issue?
.OR. (FORTRAN) there is an import issue getting something you don’t know you are getting.
J.D.
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows
From: @.> Sent: Wednesday, July 6, 2022 7:12 AM To: @.> Cc: J.D. @.>; @.> Subject: Re: [ldtp/ldtp2] Python3 support (#58)
When I use this branch on RHEL 9 with Python 3.9, LDTP daemon is not starting when I import ldtp in Python prompt / script. Following error is generated, client is unable to connect to server.
Command ldtp is working fine on Terminal, issue is only with Python import.
from ldtp import * Traceback (most recent call last): File "
", line 1, in File "/usr/local/lib/python3.9/site-packages/ldtp-3.6.0-py3.9.egg/ldtp/init.py", line 594, in _populateNamespace(globals()) File "/usr/local/lib/python3.9/site-packages/ldtp-3.6.0-py3.9.egg/ldtp/init.py", line 247, in _populateNamespace for method in client._client.system.listMethods(): File "/usr/lib64/python3.9/xmlrpc/client.py", line 1122, in call return self.send(self.name, args) File "/usr/lib64/python3.9/xmlrpc/client.py", line 1464, in request response = self.transport.request( File "/usr/local/lib/python3.9/site-packages/ldtp-3.6.0-py3.9.egg/ldtp/client.py", line 156, in request h=self.send_request(host, handler, request_body, bool(verbose)) File "/usr/lib64/python3.9/xmlrpc/client.py", line 1291, in send_request self.send_content(connection, request_body) File "/usr/lib64/python3.9/xmlrpc/client.py", line 1321, in send_content connection.endheaders(request_body) File "/usr/lib64/python3.9/http/client.py", line 1280, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/lib64/python3.9/http/client.py", line 1040, in _send_output self.send(msg) File "/usr/lib64/python3.9/http/client.py", line 980, in send self.connect() File "/usr/lib64/python3.9/http/client.py", line 946, in connect self.sock = self._create_connection( File "/usr/lib64/python3.9/socket.py", line 844, in create_connection raise err File "/usr/lib64/python3.9/socket.py", line 832, in create_connection sock.connect(sa) OSError: [Errno 99] Cannot assign requested address
Didn't observe this issue with python2 version. Could you let us know what might be the issue ?
— Reply to this email directly, view it on GitHubhttps://github.com/ldtp/ldtp2/pull/58#issuecomment-1176094528, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANGY2BFCBENWEEKCGSGFUD3VSVS2ZANCNFSM4NILHRPQ. You are receiving this because you were mentioned.Message ID: @.***>
No, there is port reservation. LDTP Engine uses that port but that engine is not started when we import in python prompt. So LDTP client is unable to open socket to server ( server is not started ). Checking for some more insights.
OK – I get it. This morning I am taking my working code from an Ubuntu 20.04 to an openSUSE 15.4 and create the smallest possible LDTP test possible. I have way more experience with the code now and will hopefully have better insight into what should be happening vs. what is happening.
Currently I get 2 very different behaviors on the 2 different Linux distros. The biggest issue seems to be the GDK stuff.
I swapped out the gobject with the pgi version of gobject – real bother…
your_path/site-packages/twisted/internet/gtk2reactor.py file
I’m not convinced the changes I made helped.
19 # System Imports
20 import sys
21
22 # ADD THESE TWO LINES
23 import pgi
24 from pgi.repository import GObject as gobject
25
26
27 #EXISTING CODE
28 from twisted.internet import _glibbase
29 from twisted.python import runtime
….
Then find and remove (comment it out) this line around ~LINE 51
import gobject # type: ignore[import]
ALSO – I found 2 different scripts named “ldtp” one was an installation script and the other is the one that starts the server. I deleted the installation script.
J.D.
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows
From: @.> Sent: Thursday, July 7, 2022 8:59 AM To: @.> Cc: J.D. @.>; @.> Subject: Re: [ldtp/ldtp2] Python3 support (#58)
No, there is port reservation. LDTP Engine uses that port but that engine is not started when we import in python prompt. So LDTP client is unable to open socket to server ( server is not started ). Checking for some more insights.
— Reply to this email directly, view it on GitHubhttps://github.com/ldtp/ldtp2/pull/58#issuecomment-1177574346, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANGY2BEEASRHPMLV5SOF2RDVS3ICZANCNFSM4NILHRPQ. You are receiving this because you were mentioned.Message ID: @.***>
I believe there is an issue here:
I replaced package gi wit3h the package pgi and changed the code everywhere to use pgi vs. gi
In pPackage pgi->overrides->GLib.py
Around line 797 and 803
funcfdtransform = lambda , cond, data: callback(channel,cond,data)
It has too many parameters and I tried eliminating them one at a time and if I remove *data it hangs…
J.D.
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows
From: @.> Sent: Thursday, July 7, 2022 8:59 AM To: @.> Cc: J.D. @.>; @.> Subject: Re: [ldtp/ldtp2] Python3 support (#58)
No, there is port reservation. LDTP Engine uses that port but that engine is not started when we import in python prompt. So LDTP client is unable to open socket to server ( server is not started ). Checking for some more insights.
— Reply to this email directly, view it on GitHubhttps://github.com/ldtp/ldtp2/pull/58#issuecomment-1177574346, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANGY2BEEASRHPMLV5SOF2RDVS3ICZANCNFSM4NILHRPQ. You are receiving this because you were mentioned.Message ID: @.***>
Hi
On my setup this fixes ldtp to work with python3 I only tested in the context of my xfce-test project: https://github.com/schuellerf/xfce-test