jwass / geojsonio.py

Open GeoJSON data on geojson.io
BSD 2-Clause "Simplified" License
121 stars 25 forks source link

ValueError: startfile: filepath too long for Windows #8

Open robmarkcole opened 7 years ago

robmarkcole commented 7 years ago

When running:

from geojsonio import display
with open('map.geojson') as f:
    contents = f.read()
    display(contents)

with data from Google in the file map.geojson I receive the following error:

ValueError                                Traceback (most recent call last)
<ipython-input-6-cd14c4214ce4> in <module>()
      3 with open('map.geojson') as f:
      4     contents = f.read()
----> 5     display(contents)

C:\ProgramData\Anaconda3\lib\site-packages\geojsonio\geojsonio.py in display(contents, domain, force_gist)
     35     """
     36     url = make_url(contents, domain, force_gist)
---> 37     webbrowser.open(url)
     38     return url
     39 # display() used to be called to_geojsonio. Keep it around for now...

C:\ProgramData\Anaconda3\lib\webbrowser.py in open(url, new, autoraise)
     58     for name in _tryorder:
     59         browser = get(name)
---> 60         if browser.open(url, new, autoraise):
     61             return True
     62     return False

C:\ProgramData\Anaconda3\lib\webbrowser.py in open(self, url, new, autoraise)
    511         def open(self, url, new=0, autoraise=True):
    512             try:
--> 513                 os.startfile(url)
    514             except OSError:
    515                 # [Error 22] No application is associated with the specified

ValueError: startfile: filepath too long for Windows
jwass commented 7 years ago

Hi @robmarkcole, I don't have Windows so it's difficult for me to figure out what the real max. length would be. Do you think you could help figure it out on your machine?

A workaround is to use display(..., force_gist=True)

HADDADENICAR commented 6 years ago

i have the same problem after adding force_gist=True i have the following error AuthenticationFailed: 401 Requires authentication

minroh commented 5 years ago

I get the same error:

AuthenticationFailed: 401 Requires authentication I have Windows 10 Enterprise x64 Python 3.6.4

tomchristian commented 5 years ago

I have the same issue as Haddadenicar and Minroh. In the 1st case I get: ValueError: startfile: filepath too long for Windows With force_gist=True, I get: AuthenticationFailed: 401 Requires authentication

jwnys commented 4 years ago

Same problem here

nicelgueta commented 4 years ago

Has anyone managed to find a workaround for this? Still encountering the same issues described above - file too long, then 401 with force_gist. geojsonio==0.0.3

kevin552216 commented 4 years ago

I use make_url instead of display to avoid this error. Here's the step. room = geopandas.read_file("file").to_json() url = geojsonio.make_url(room) print(url)

double click the url

image image

xavfa commented 3 years ago

Hi, I am facing the same issue, but using the above workaround gives me error due to too long url....is there any other workaround ? My try is to over plot building's footprint on map and I get this message (ValueError: startfile: filepath too long for Windows) when I try to plot too many buildings. Thus is there a work round by making a loop for plotting element but pointing the same page ? Thanks in advance for any help