[L13] Some issues with python v3.12 and v3.13

148 views
Skip to first unread message

Sean

unread,
Oct 18, 2024, 11:13:57 PM10/18/24
to Python Challenge
Hi, just a comment. I had to use a different library to be able to pass the level, because the library that is supposed to be the correct one throws an exception. I'm not sure if it only happens on my machine, so I'd appreciate if someone else could confirm the problem.

In order not to reveal anything about the solution of the level, I will only share the exception.

raise BadGzipFile('Not a gzipped file (%r)' % magic) 



Jack Bass

unread,
Oct 19, 2024, 1:37:58 PM10/19/24
to Python Challenge
Ha, I'm currently on L13 and am getting that error. I had a feeling it was due to something being outdated. But, you still managed to complete the level? Is the alternate library you used part of Python's standard libaries, or external?

Alvaro Martínez

unread,
Oct 22, 2024, 12:35:07 PM10/22/24
to Python Challenge
Confirmed on Python 3.11. The code of the module is looking for a specific signature in the first two bytes of the server response, and that signature is not present.

Not sure if the behavior of the module is correct in this case, it seems to be overly strict judging by some of the issues which can be found online regarding "not a gzipped file" errors. Some of those quite recent, in fact.

It is possible to disable the involvement of gzip in the process by creating a subclass of Transport and passing it to the constructor of the *you know what* object, as follows:

class MyTransport(themoduleyouneedtouse.Transport):
    accept_gzip_encoding = False

TheClassYouNeedToInstantiate(url, transport=MyTransport)

That solves the problem with the requests, but of course is not someone trying to solve the challenge would find easily or think about doing.

I guess the server should be modified to include that missing signature (which might or might not break other versions of Python or other libraries), or just disable gzip for its response.


El 19/10/24 a las 05:13, Sean escribió:
Hi, just a comment. I had to use a different library to be able to pass the level, because the library that is supposed to be the correct one throws an exception. I'm not sure if it only happens on my machine, so I'd appreciate if someone else could confirm the problem.

In order not to reveal anything about the solution of the level, I will only share the exception.

raise BadGzipFile('Not a gzipped file (%r)' % magic) 



--
You received this message because you are subscribed to the Google Groups "Python Challenge" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-challen...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-challenge/a1b96c76-7f16-4d7e-bd04-af7e5724dcd3n%40googlegroups.com.

Alvaro Martínez

unread,
Oct 22, 2024, 12:35:10 PM10/22/24
to Python Challenge
Reply all
Reply to author
Forward
0 new messages