-
Notifications
You must be signed in to change notification settings - Fork 385
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
Exception on startup: TypeError: GLib.filename_to_utf8() takes exactly 2 arguments (4 given) #634
Comments
Thanks for bug report! Could you help us out by telling us which Linux Distro you installed this on? Plus what were your steps to install it? Did you manually build, or did you use something like the AUR? |
Here's reference info for
|
@odysseywestra I use Manjaro (Arch derivative) and I installed it from AUR mypaint-git package. |
Turns out I had 3.18 version of pygobject so I upgraded. It did not help though.
|
This simple code produces the same error.
If I remove the last two arguments it returns |
🌈🌠 ... and that is why we wrap certain inconsistently annotated GLib calls... :SIGH: At least upstream are fixing it for G-I uses. Sadly they're fixing it in a way that breaks stuff... This is where the call's coming from: https://github.com/mypaint/mypaint/blob/v1.2.0/lib/glib.py#L57. I'm guessing we should try # See https://github.com/mypaint/mypaint/issues/634
try:
ustring = GLib.filename_to_utf8(opsysstring, -1)
except TypeError:
ustring = GLib.filename_to_utf8(opsysstring, -1, 0, 0) in its place. I'm using @jtojnar please can you try: >>> from gi.repository import GLib
>>> GLib.filename_to_utf8(opsysstring="test2", len=-1, bytes_read=0, bytes_written=0)
'test2' to see if your typelib binding still accepts the junk args as keywords? Because that might be a nicer way of writing it. If not we can catch the exception as above & do it that way. |
Nope.
|
Noted! The Python return type will be different if the params are annotated as |
@jtojnar our versions look very similar, but I'm happy to add a try/except fix to master for now even if it's puzzling. If you have the time, can you comment with details of the plumbing of of the G-I mess on your system?
It could just be something that Arch/Manjaro do but Debian don't... |
|
Fixes an exception when g_filename_to_utf8() has a more sensible wrapping than our old expectation ☺ Addresses #634. Also remove pointless import from doctest.
@jtojnar Thanks for the info. Looks like it's caused by 1.46→1.48 in the package owning GLib-2.0.typelib, or at least it has the shape of it. You can see if there's an override by opening the |
👣 🔍 I detectived! GLib fixed up their annotations in 25a7c81 (mirror: GNOME/glib@25a7c81), included in 2.48. The generated typelib files are updating in Debian too, but they're in experimental only right now: http://packages.debian.org/gir1.2-glib-2.0. |
There is only # backwards compatible API with default argument, and ignoring bytes_read
# output argument
def filename_from_utf8(utf8string, len=-1):
return GLib.filename_from_utf8(utf8string, len)[0] I tried downgrading the gobject-introspection-git to 1.46.0 and can confirm it is working. It just does not work with version ≥ 1.47 so your assumption about 1.46→1.48 seems to be correct. |
Thanks - hopefully the new MyPaint master will work on 1.48 systems. Let me know how it goes 😄 |
Yes it works, thank you. |
Thanks. Applied for 1.2.1 ☺ |
Downstream instance: https://bugs.debian.org/822784. Better get 1.2.1 proper out of the door soon :( |
To not downgrade Glib, I removed in /opt/local/share/mypaint/lib/glib.py:
And just return:
But the filenames must be compatible with the UTF-8. I advise:
|
Hello,
I installed mypaint from git and it is crashing on startup. My glib2 version is 2.48.0.5. The same problem also occurs with glib 2.45.6.42 (the earliest version I can downgrade to).
The text was updated successfully, but these errors were encountered: