Coder Social home page Coder Social logo

Error 404 on leaflet.py example about flexx HOT 9 CLOSED

Galeras14 avatar Galeras14 commented on August 15, 2024
Error 404 on leaflet.py example

from flexx.

Comments (9)

jrversteegh avatar jrversteegh commented on August 15, 2024 1

It looks like it needs an "Accept-Encoding" header.

wget https://cdnjs.cloudflare.com/ajax/libs/leaflet//1.0.3/images/marker-icon.png

doesn't work, but

wget --header='Accept-Encoding: gzip, deflate, br' https://cdnjs.cloudflare.com/ajax/libs/leaflet//1.0.3/images/marker-icon.png

does.

from flexx.

almarklein avatar almarklein commented on August 15, 2024 1

Thanks @jrversteegh, that explains it, and I manage to get the example working again in #742.

@Galeras14 Could you please check whether #742 fixes it for you to?

from flexx.

Galeras14 avatar Galeras14 commented on August 15, 2024 1

I've kind of solve the issue of urllib3 following #3020 issue on urllib3.
Still, the leaflet.py example give me this error, even we the suggested modifications:

Traceback (most recent call last):
File "/Users/admin/PycharmProjects/Genealogie/sample/ui/essai.py", line 82, in
flx.assets.add_shared_data(icon, _get_data('images/%s' % icon))
File "/Users/admin/PycharmProjects/Genealogie/sample/ui/essai.py", line 53, in _get_data
assert res.ok, f"{res.status_code}: {res.reason}"
AssertionError: 404: Not Found

from flexx.

almarklein avatar almarklein commented on August 15, 2024

I can reproduce that it does not work. The first exception is when the script tries to obtain https://cdnjs.cloudflare.com/ajax/libs/leaflet//1.0.3/images/marker-icon.png. However, it works fine when I copy-paste that link in the browser. Same for https://cdnjs.cloudflare.com/ajax/libs/leaflet//1.0.3/leaflet.js when I comment the lines that downloads the icons.

So it may be related to the user agent - perhaps leaflet is trying to prevent non-browsers from using the API

from flexx.

Galeras14 avatar Galeras14 commented on August 15, 2024

Hi, thanks a lot for your help. However I'm still having trouble.
I get this error message from _get data function:

assert res.ok, f"{res.status_code}: {res.reason}"
AssertionError: 404: Not Found

In addition, I'm now having a warning message:

/Users/admin/PycharmProjects/Genealogie/env/lib/python3.7/site-packages/urllib3/init.py:38: NotOpenSSLWarning: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: urllib3/urllib3#3020
exceptions.NotOpenSSLWarning,

Not sure if it is Mac environment or if it is because I'm using Python 3.8.

from flexx.

almarklein avatar almarklein commented on August 15, 2024

Is that the system Python 3.8? Have you tried upgrading to the latest urllib3 using e.g. pip install -U urllib3?

from flexx.

Galeras14 avatar Galeras14 commented on August 15, 2024

Yes, I'm in the latest version of urllib3, 2.0.7

from flexx.

almarklein avatar almarklein commented on August 15, 2024

Mmm. It's pretty annoying that leaflet produces a 404, and not a more meaningful error code. This way there is no way to see whether the problem is the header or your wifi being down 😕

I tried #742 and I got the same error. It looks like I was trying out some stuff and pushed the wrong version. I updated that PR to the version that works for me too. Sorry for that!

edited: I initially linked to the wrong pr above because of a typo, which I now fixed

from flexx.

Galeras14 avatar Galeras14 commented on August 15, 2024

With your modification, the example works for me and my app works again.
Thanks a lot !

from flexx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.