Unable to connect signals to Python slots with non-ASCII names

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Unable to connect signals to Python slots with non-ASCII names

Shriramana Sharma
Hello. This is related to my recent post. I'm using PyQt
5.5.1+dfsg-3ubuntu4 with Py 3.5.1-3 default on Kubuntu Xenial 64 bit.
I'm using non-ASCII words for user-defined
variables and methods. Actually it's in an Indic script but for
readers' convenience as minimal example I give the attached code with
French.

I am connecting a signal to a Python method with non-ASCII name.
Trying to execute the app results in a segfault. The fix is to replace
the function name (as in line 9) with a bare lambda that calls the
function (commented in line 10).

--
Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा 𑀰𑁆𑀭𑀻𑀭𑀫𑀡𑀰𑀭𑁆𑀫𑀸

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

pyqt_non_ascii_slot.py (598 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Unable to connect signals to Python slots with non-ASCII names

Florian Bruhin
On Mon, Dec 11, 2017 at 08:28:11AM +0530, Shriramana Sharma wrote:

> Hello. This is related to my recent post. I'm using PyQt
> 5.5.1+dfsg-3ubuntu4 with Py 3.5.1-3 default on Kubuntu Xenial 64 bit.
> I'm using non-ASCII words for user-defined
> variables and methods. Actually it's in an Indic script but for
> readers' convenience as minimal example I give the attached code with
> French.
>
> I am connecting a signal to a Python method with non-ASCII name.
> Trying to execute the app results in a segfault. The fix is to replace
> the function name (as in line 9) with a bare lambda that calls the
> function (commented in line 10).
I can reproduce that with PyQt 5.9 and get:

  ASSERT: "f_name" in file ../qpy/QtCore/qpycore_pyqtboundsignal.cpp, line 810

When decorating it with @pyqtSlot, I get:

  UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 1: ordinal not in range(128)

Florian

--
https://www.qutebrowser.org  | [hidden email] (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072  | https://the-compiler.org/pubkey.asc
         I love long mails!  | https://email.is-not-s.ms/

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Unable to connect signals to Python slots with non-ASCII names

Phil Thompson-5
In reply to this post by Shriramana Sharma
On 11 Dec 2017, at 2:58 am, Shriramana Sharma <[hidden email]> wrote:

>
> Hello. This is related to my recent post. I'm using PyQt
> 5.5.1+dfsg-3ubuntu4 with Py 3.5.1-3 default on Kubuntu Xenial 64 bit.
> I'm using non-ASCII words for user-defined
> variables and methods. Actually it's in an Indic script but for
> readers' convenience as minimal example I give the attached code with
> French.
>
> I am connecting a signal to a Python method with non-ASCII name.
> Trying to execute the app results in a segfault. The fix is to replace
> the function name (as in line 9) with a bare lambda that calls the
> function (commented in line 10).

Tonight's snapshot will raise an encoding error.

Thanks,
Phil
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Unable to connect signals to Python slots with non-ASCII names

Shriramana Sharma
Will raise or will not raise? May I add that the error happens even with the # -*- type of encoding declared?

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Unable to connect signals to Python slots with non-ASCII names

Phil Thompson-5
On 12 Dec 2017, at 2:38 pm, Shriramana Sharma <[hidden email]> wrote:
>
> Will raise or will not raise? May I add that the error happens even with the # -*- type of encoding declared?

Will raise. The issue is that the slot name is passed to Qt as a char* and I'm not sure if this has to be ASCII.

Phil
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Unable to connect signals to Python slots with non-ASCII names

Barry Scott


> On 12 Dec 2017, at 15:03, Phil Thompson <[hidden email]> wrote:
>
>> On 12 Dec 2017, at 2:38 pm, Shriramana Sharma <[hidden email]> wrote:
>>
>> Will raise or will not raise? May I add that the error happens even with the # -*- type of encoding declared?
>
> Will raise. The issue is that the slot name is passed to Qt as a char* and I'm not sure if this has to be ASCII.

I guess you wondered if utf-8 could be used but see no Qt docs saying what is allowed?

Barry

>
> Phil
> _______________________________________________
> PyQt mailing list    [hidden email]
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt