Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 / wxPython 4 Support #78

Open
swt2c opened this issue Jan 26, 2019 · 19 comments
Open

Python 3 / wxPython 4 Support #78

swt2c opened this issue Jan 26, 2019 · 19 comments

Comments

@swt2c
Copy link

swt2c commented Jan 26, 2019

Now that wxPython 4 is out (with Python 3 support) it would be great if wammu supported wxPython 4 and Python 3.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@nijel
Copy link
Member

nijel commented Jan 26, 2019

Patches are welcome, it's unlikely that I will find time for that.

@swt2c
Copy link
Author

swt2c commented Jan 26, 2019

I may take a stab at it. I'm assuming you would want to retain Python 2 / wxPython 3.x support as well?

@nijel
Copy link
Member

nijel commented Jan 26, 2019

I would not mind dropping Python 2 support

@sergiomb2
Copy link

Hello ,
@swt2c , now with Fedora dropping python 2 [1] and [2]

[1]
https://fedoraproject.org/wiki/Changes/RetirePython2

[2]
https://bugzilla.redhat.com/show_bug.cgi?id=1737869

@swt2c
Copy link
Author

swt2c commented Sep 3, 2019

Yes, @sergiomb2 that was my motivation in the first place. However, I'm not very motivated as I don't actually use wammu.

@sergiomb2
Copy link

ya , even https://github.com/gammu/wammu/blob/master/setup.py is not python 3 compatible ...
I don't use this software since 2 or 4 years ago with usb pen mobile network 3G

@swt2c
Copy link
Author

swt2c commented Sep 3, 2019

Maybe just retire it from Fedora?

@nijel nijel pinned this issue Sep 4, 2019
@nijel
Copy link
Member

nijel commented Sep 4, 2019

The same issue is on Debian, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=938807

@sergiomb2
Copy link

Let me know if any progress on Debian package I will follow it on Fedora .

Thanks

@nijel
Copy link
Member

nijel commented Sep 7, 2019

Unless somebody steps up to implement needed changes, the package will be removed.

@lgbaldoni
Copy link

How does 33faf64 relate to this?

@nijel
Copy link
Member

nijel commented Mar 1, 2022

There is no relationship. It is just a bump of a GitHub action...

@kamikaze-kun
Copy link

Hello. I am trying to make Wammu working on Python 3 during spare time at work. It's Windows 7 PC with limited (because security) internet, and I upload many changes at once later at home. I worked with Delphi for several years and Python is new for me but it is very interesting. Hopefully there are a lot of documentation and advice over the web.

Next thing to fix: SMS and Messages export. These are the main things why I use Wammu.
Still no success in loading locale files…

Please check my Wammu fork. Looking forward to any help.

@Jancs-E
Copy link

Jancs-E commented May 2, 2023

Hi! Any news regarding use of Wammu on Linux having Python 3.9? I went around one issue, but wammu expects wxPython being installed under 2.7.

@ppisa
Copy link

ppisa commented Jan 14, 2024

I have successfully tested fork https://github.com/kamikaze-kun/wammu. The branch python3 works for me with some minor corrections.

--- Main.py.orig        2024-01-14 10:46:20.917228159 +0100
+++ Main.py     2024-01-14 10:47:56.017224259 +0100
@@ -975,7 +975,7 @@

     def OnProgress(self, evt):
         if hasattr(self, 'progress'):
-            if not self.progress.Update(evt.progress):
+            if not self.progress.Update(round(evt.progress)):
                 try:
                     evt.cancel()
                 except:

to resolve

  File "/opt/gammu/lib/python3.11/dist-packages/wammu-0.44-py3.11.egg/Wammu/Main.py", line 978, in OnProgress
    if not self.progress.Update(evt.progress):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Exception: TypeError: ProgressDialog.Update(): argument 1 has unexpected type 'float'

and I have some problems with resources/images lookup solved by

--- Paths.py.orig       2024-01-14 02:58:13.430861085 +0100
+++ Paths.py    2024-01-14 01:56:29.882999398 +0100
@@ -36,6 +37,8 @@
     os.path.join(os.path.dirname(__file__).replace('lib/python2.7/dist-packages/Wammu', ''), 'share', 'Wammu'),
      # Local directory
     os.path.join(os.path.dirname(__file__), '..'),
+    os.path.join(os.path.dirname(__file__), '../share/Wammu'),
+    #os.path.join(os.path.dirname(__file__), '/opt/gammu/lib/python3.11/dist-packages/wammu-0.44-py3.11.egg/share'),
 ]

 def CheckImagesPath(path):

My test are on Debian 12.4 (Bookworm, actual stable). The gammu, python_gammu and wammu are build into /opt/gammu prefix and hacked and symlinked to /usr/local/bin, /usr/local/lib and /usr/local/lib/python3.11/dist-packages.

@dreirund
Copy link

dreirund commented Mar 7, 2025

Ahoj @kamikaze-kun,

I was trying your fork https://github.com/kamikaze-kun/wammu, Python3 branch. Many thanks for it!
Can you activate issue reporting in your repository, so that issues can properly reported there and do not need to spam this thread, as I do now?

OK, here some issue report with your Python3 fork, @kamikaze-kun:

When I launch wammu, then click in the Menu "Wammu" → "Settings", I get a dialogue window saying

Unhandled exception appeared. If you want to help improving this program, please report this together with description how this situation has happened. Please report in english, otherwise you will be most likely told to translate you report to english later.

Traceback:
  File "/usr/lib/python3.13/site-packages/wx/lib/rcsizer.py", line 153, in CalcMin
    size = wx.Size( reduce( operator.add, self.colWidths),
                    reduce( operator.add, self.rowHeights) )

Exception: TypeError: Size(): arguments did not match any overloaded call:
  overload 1: too many arguments
  overload 2: argument 1 has unexpected type 'float'
  overload 3: argument 1 has unexpected type 'float'


Debug log has been automatically saved to /tmp/wammu-crash-hd3j7oux.log, you are strongly encouraged to include it in bugreport.

Image


The file /tmp/wammu-crash-hd3j7oux.log contains

--------------- System information ----------------
Platform     linux
Python       3.13.2
wxPython     4.2.2
Wammu        0.44
python-gammu 3.2
Gammu        1.42.0
Bluetooth    PyBluez
locales      en_US (UTF-8)
connection   at
device       /dev/ttyUSB3
model        
Unhandled exception appeared.

If you want to help improving this program, please submit following infomation and description how did it happen to https://github.com/gammu/wammu/issues/. Please report in english, otherwise you will be most likely told to translate you report to english later.

Debug log was saved for phone communication, if this error appeared during communicating with phone, you are strongly encouraged to include it in bugreport. Debug log is saved in file /tmp/wammu-crash-hd3j7oux.log.


--------------- System information ----------------
Platform     linux
Python       3.13.2
wxPython     4.2.2
Wammu        0.44
python-gammu 3.2
Gammu        1.42.0
Bluetooth    PyBluez
locales      en_US (UTF-8)
connection   at
device       /dev/ttyUSB3
model        

------------------ Traceback ID -------------------
N/A
-------------------- Traceback --------------------
  File "/usr/lib/python3.13/site-packages/wx/lib/rcsizer.py", line 153, in CalcMin
    size = wx.Size( reduce( operator.add, self.colWidths),
                    reduce( operator.add, self.rowHeights) )
-------------------- Exception --------------------
TypeError: Size(): arguments did not match any overloaded call:
  overload 1: too many arguments
  overload 2: argument 1 has unexpected type 'float'
  overload 3: argument 1 has unexpected type 'float'
---------------------------------------------------

When I click "OK" in this dialogue window, a next one appears with the content

Unhandled exception appeared. If you want to help improving this program, please report this together with description how this situation has happened. Please report in english, otherwise you will be most likely told to translate you report to english later.

Traceback:
  File "/usr/lib/python3.13/site-packages/wx/lib/rcsizer.py", line 163, in RecalcSizes
    minWidth, minHeight  = self.CalcMin()
                           ~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/wx/lib/rcsizer.py", line 153, in CalcMin
    size = wx.Size( reduce( operator.add, self.colWidths),
                    reduce( operator.add, self.rowHeights) )

Exception: TypeError: Size(): arguments did not match any overloaded call:
  overload 1: too many arguments
  overload 2: argument 1 has unexpected type 'float'
  overload 3: argument 1 has unexpected type 'float'


Debug log has been automatically saved to /tmp/wammu-crash-jmzl1lcs.log, you are strongly encouraged to include it in bugreport.

The file /tmp/wammu-crash-jmzl1lcs.log contains


--------------- System information ----------------
Platform     linux
Python       3.13.2
wxPython     4.2.2
Wammu        0.44
python-gammu 3.2
Gammu        1.42.0
Bluetooth    PyBluez
locales      en_US (UTF-8)
connection   at
device       /dev/ttyUSB3
model        
Unhandled exception appeared.

If you want to help improving this program, please submit following infomation and description how did it happen to https://github.com/gammu/wammu/issues/. Please report in english, otherwise you will be most likely told to translate you report to english later.

Debug log was saved for phone communication, if this error appeared during communicating with phone, you are strongly encouraged to include it in bugreport. Debug log is saved in file /tmp/wammu-crash-jmzl1lcs.log.


--------------- System information ----------------
Platform     linux
Python       3.13.2
wxPython     4.2.2
Wammu        0.44
python-gammu 3.2
Gammu        1.42.0
Bluetooth    PyBluez
locales      en_US (UTF-8)
connection   at
device       /dev/ttyUSB3
model        

------------------ Traceback ID -------------------
N/A
-------------------- Traceback --------------------
  File "/usr/lib/python3.13/site-packages/wx/lib/rcsizer.py", line 163, in RecalcSizes
    minWidth, minHeight  = self.CalcMin()
                           ~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/wx/lib/rcsizer.py", line 153, in CalcMin
    size = wx.Size( reduce( operator.add, self.colWidths),
                    reduce( operator.add, self.rowHeights) )
-------------------- Exception --------------------
TypeError: Size(): arguments did not match any overloaded call:
  overload 1: too many arguments
  overload 2: argument 1 has unexpected type 'float'
  overload 3: argument 1 has unexpected type 'float'
---------------------------------------------------

When I click "OK" on that window, I get an empty dialogue window only with a "Cancel" button in the top left corner.

When I then click again on "Wammu" → "Settings", the empty dialogue appears straight away.

I can connect to the phone (at least I do not get any error). When I want to retrieve messages, a dialogue pops up with the error message

Unhandled exception appeared. If you want to help improving this program, please report this together with description how this situation has happened. Please report in english, otherwise you will be most likely told to translate you report to english later.

Traceback:
  File "/usr/lib/python3.13/site-packages/Wammu/Main.py", line 978, in OnProgress
    if not self.progress.Update(evt.progress):
           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^

Exception: TypeError: ProgressDialog.Update(): argument 1 has unexpected type 'float'


Debug log has been automatically saved to /tmp/wammu-crash-55h9xh79.log, you are strongly encouraged to include it in bugreport.

The file /tmp/wammu-crash-55h9xh79.log contains


--------------- System information ----------------
Platform     linux
Python       3.13.2
wxPython     4.2.2
Wammu        0.44
python-gammu 3.2
Gammu        1.42.0
Bluetooth    PyBluez
locales      en_US (UTF-8)
connection   at
device       /dev/ttyUSB3
model        
Fri 2025/03/07 18:19:52: [Gammu            - 1.42.0]
Fri 2025/03/07 18:19:52: [Connection       - "at"]
Fri 2025/03/07 18:19:52: [Connection index - 0]
Fri 2025/03/07 18:19:52: [Model type       - ""]
Fri 2025/03/07 18:19:52: [Device           - "/dev/ttyUSB3"]
Fri 2025/03/07 18:19:52: [Running on       - Linux, kernel 6.13.5-xanmod-customconfig-clang (#1 SMP PREEMPT_DYNAMIC Wed, 05 Mar 2025 11:09:38 +0000)]
Fri 2025/03/07 18:19:53: Serial device: DTR is up, RTS is up, CAR is down, CTS is down
Fri 2025/03/07 18:19:53: Setting speed to 115200
Fri 2025/03/07 18:19:53: [Module           - "auto"]
Fri 2025/03/07 18:19:53: Escaping SMS mode
Fri 2025/03/07 18:19:53: SENDING frame type 0x00/length 0x02/2
Fri 2025/03/07 18:19:53: 1B |0D                                                          ..              
Fri 2025/03/07 18:19:53: Sending simple AT command to wake up some devices
Fri 2025/03/07 18:19:53: SENDING frame type 0x00/length 0x03/3
Fri 2025/03/07 18:19:53: 41A|54T|0D                                                      AT.             
Fri 2025/03/07 18:19:53: 1 "AT"
Fri 2025/03/07 18:19:53: 2 "OK"
[...]
Fri 2025/03/07 18:20:14: RECEIVED frame type 0x00/length 0x34/52
Fri 2025/03/07 18:20:14: 41A|54T|2B+|43C|50P|4DM|53S|3D=|22"|4DM|45E|22"|2C,|22"|4DM|45E AT+CPMS="ME","ME
Fri 2025/03/07 18:20:14: 22"|0D |0D |0A |2B+|43C|50P|4DM|53S|3A:|20 |322|2C,|322|355|355 "...+CPMS: 2,255
Fri 2025/03/07 18:20:14: 2C,|322|2C,|322|355|355|2C,|322|2C,|322|355|355|0D |0A |0D |0A  ,2,255,2,255....
Fri 2025/03/07 18:20:14: 4FO|4BK|0D |0A                                                  OK..            
Fri 2025/03/07 18:20:14: SMS status received
Fri 2025/03/07 18:20:14: Parsing +CPMS: 2,255,2,255,2,255 with +CPMS: @i, @i, @0
Fri 2025/03/07 18:20:14: Parsed int 2
Fri 2025/03/07 18:20:14: Parsed int 255
Fri 2025/03/07 18:20:14: Used : 2
Fri 2025/03/07 18:20:14: Size : 255
Fri 2025/03/07 18:20:14: Leaving GSM_GetSMSStatus
Fri 2025/03/07 18:20:14: Entering GSM_GetNextSMS
Fri 2025/03/07 18:20:14: Starting reading!
Fri 2025/03/07 18:20:14: Number = 0, Location = -1, Folder = 0
Fri 2025/03/07 18:20:14: Trying SMS PDU mode
Fri 2025/03/07 18:20:14: SENDING frame type 0x00/length 0x0A/10
Fri 2025/03/07 18:20:14: 41A|54T|2B+|43C|4DM|47G|46F|3D=|300|0D                          AT+CMGF=0.      
Unhandled exception appeared.

If you want to help improving this program, please submit following infomation and description how did it happen to https://github.com/gammu/wammu/issues/. Please report in english, otherwise you will be most likely told to translate you report to english later.

Debug log was saved for phone communication, if this error appeared during communicating with phone, you are strongly encouraged to include it in bugreport. Debug log is saved in file /tmp/wammu-crash-55h9xh79.log.


--------------- System information ----------------
Platform     linux
Python       3.13.2
wxPython     4.2.2
Wammu        0.44
python-gammu 3.2
Gammu        1.42.0
Bluetooth    PyBluez
locales      en_US (UTF-8)
connection   at
device       /dev/ttyUSB3
model        

------------------ Traceback ID -------------------
N/A
-------------------- Traceback --------------------
  File "/usr/lib/python3.13/site-packages/Wammu/Main.py", line 978, in OnProgress
    if not self.progress.Update(evt.progress):
           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
-------------------- Exception --------------------
TypeError: ProgressDialog.Update(): argument 1 has unexpected type 'float'
---------------------------------------------------

(Full log file attached: wammu-crash-55h9xh79.log.)

When I click "OK" in this dialogue, I actually can see the two SMS messages on the device.


And runnint pytest (to run tests) has some failures, too:

======================================================================================== test session starts ========================================================================================
platform linux -- Python 3.13.2, pytest-8.3.5, pluggy-1.5.0
rootdir: /var/cache/makepkg/build/wammu-git/src/wammu
plugins: anyio-4.8.0, typeguard-4.4.2
collected 5 items                                                                                                                                                                                   

Wammu/test_imap.py FFF                                                                                                                                                                        [ 60%]
Wammu/test_paths.py .                                                                                                                                                                         [ 80%]
Wammu/test_utils.py .                                                                                                                                                                         [100%]

============================================================================================= FAILURES ==============================================================================================
________________________________________________________________________________________ IMAPTest.test_codec ________________________________________________________________________________________

self = <Wammu.test_imap.IMAPTest testMethod=test_codec>

    def test_codec(self):
        self.assertEqual(
            TEST,
>           TEST.encode('imap4-utf-7').decode('imap4-utf-7')
        )
E       LookupError: unknown encoding: imap4-utf-7

Wammu/test_imap.py:42: LookupError
_______________________________________________________________________________________ IMAPTest.test_decode ________________________________________________________________________________________

self = <Wammu.test_imap.IMAPTest testMethod=test_decode>

    def test_decode(self):
        self.assertEqual(
            TEST,
>           decoder(encoder(TEST)[0])[0]
        )

Wammu/test_imap.py:36: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Wammu/IMAP.py:41: in encoder
    r.extend(['&', modified_base64(''.join(_in)), '-'])
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

s = 'říš'

    def modified_base64(s):
        s_utf7 = s.encode('utf-7')
>       return s_utf7[1:-1].replace('/', ',')
E       TypeError: a bytes-like object is required, not 'str'

Wammu/IMAP.py:29: TypeError
_______________________________________________________________________________________ IMAPTest.test_encode ________________________________________________________________________________________

self = <Wammu.test_imap.IMAPTest testMethod=test_encode>

    def test_encode(self):
        self.assertEqual(
            ('P&AVkA7QFh-ern&ARs- &AX4-lu&AWU-ou&AQ0-k&AP0- k&AW8BSA- &APo-p&ARs-l &AQ8A4Q-belsk&AOk- &APM-dy', 40),
>           encoder(TEST)
        )

Wammu/test_imap.py:30: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Wammu/IMAP.py:41: in encoder
    r.extend(['&', modified_base64(''.join(_in)), '-'])
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

s = 'říš'

    def modified_base64(s):
        s_utf7 = s.encode('utf-7')
>       return s_utf7[1:-1].replace('/', ',')
E       TypeError: a bytes-like object is required, not 'str'

Wammu/IMAP.py:29: TypeError
====================================================================================== short test summary info ======================================================================================
FAILED Wammu/test_imap.py::IMAPTest::test_codec - LookupError: unknown encoding: imap4-utf-7
FAILED Wammu/test_imap.py::IMAPTest::test_decode - TypeError: a bytes-like object is required, not 'str'
FAILED Wammu/test_imap.py::IMAPTest::test_encode - TypeError: a bytes-like object is required, not 'str'
==================================================================================== 3 failed, 2 passed in 0.12s ====================================================================================

Regards!

@dreirund
Copy link

dreirund commented Mar 7, 2025

Want to back this issue? Post a bounty on it!

This URL does not work anymore. "Server Not Found".

@dreirund
Copy link

dreirund commented Mar 9, 2025

Another issue with your Python 3-port you might want to look at, @kamikaze-kun:

SyntaxWarning: invalid escape sequence '\d', SyntaxWarning: invalid escape sequence '\(', SyntaxWarning: invalid escape sequence '\s', SyntaxWarning: invalid escape sequence '\D'.
Not (yet) breaking runtime, but deprecated and should be changed, see this comment:

Invalid escape sequences like \d are now deprecated in Python. You may want to report it to upstream for getting rid of those patterns.

Regards!

@kamikaze-kun
Copy link

@dreirund Thank you for reports.

I think this is all because of new Python version. Then I tried to rework Wammu for Python 3 it was version 3.8.10 on Windows 7. It was two years ago and it was fun but it was just an experiment. It worked quite well though. I do not have everything installed for Python development now.

For my little needs of mobile phone backup I use Gammu on Linux. Also I built standalone Wammu on Linux Mint 19.3 with PyInstaller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants