question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fiona cannot find file in windows path with `!` character

See original GitHub issue

Expected behavior and actual behavior.

fiona cannot find file with ! in path, For example, fiona seems to interpret !test\test.geojson as test est.geojson

click validates the path successfully in my script with: @click.option(... type=click.Path(exists=True))

Based on https://ss64.com/nt/syntax-esc.html I tried escaping the ! with ^ and ^^ with no luck, click then tells me the path does not exist. Perhaps there is a better way to escape the character?

I can just copy data over to a location with a more reasonable path name but thought this might be worth reporting.

Steps to reproduce the problem.

> mkdir !test
> copy test.geojson !test\test.geojson
> python

Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import fiona
>>> with fiona.open("!test\test.geojson") as src:
...     src.crs
...
Traceback (most recent call last):
  File "fiona\_shim.pyx", line 73, in fiona._shim.gdal_open_vector
  File "fiona\_err.pyx", line 270, in fiona._err.exc_wrap_pointer
fiona._err.CPLE_OpenFailedError: 'test  est.geojson' does not exist in the file system, and is not recognized as a supported dataset name.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "Q:\projects\Mempr\Wind_Mapping\scripts\windsites\venv_36\lib\site-packages\fiona\env.py", line 406, in wrapper
    return f(*args, **kwargs)
  File "Q:\projects\Mempr\Wind_Mapping\scripts\windsites\venv_36\lib\site-packages\fiona\__init__.py", line 257, in open
    layer=layer, enabled_drivers=enabled_drivers, **kwargs)
  File "Q:\projects\Mempr\Wind_Mapping\scripts\windsites\venv_36\lib\site-packages\fiona\collection.py", line 159, in __init__
    self.session.start(self, **kwargs)
  File "fiona\ogrext.pyx", line 484, in fiona.ogrext.Session.start
  File "fiona\_shim.pyx", line 80, in fiona._shim.gdal_open_vector
fiona.errors.DriverError: 'test est.geojson' does not exist in the file system, and is not recognized as a supported dataset name.
>>>

Operating system

Windows Server 2016 Standard Version 1607

Fiona and GDAL version and provenance

Pre-built from https://www.lfd.uci.edu/~gohlke/pythonlibs/ Fiona-1.8.6-cp36-cp36m-win_amd64.whl GDAL-2.3.3-cp36-cp36m-win_amd64.whl

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sgilliescommented, Apr 10, 2019

Ah, I found a bug in fiona’s path parsing: ! causes the path to be parsed as though it were a zip archive. The workaround is to avoid ! in your filenames until we can fix this and make another release.

0reactions
snorfalorpaguscommented, Aug 8, 2019

Closed by #773.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't install Fiona on Windows - Stack Overflow
The GDAL DLL files and gdal-data directory need to be in your Windows PATH otherwise building Fiona will fail to work. Follow below...
Read more >
11 Ways to Fix "The System Cannot Find The Path Specified ...
11 Ways to Fix "The System Cannot Find The Path Specified" Error on Windows · 1. Run Command Prompt as an Administrator ·...
Read more >
Fiona 2.0dev documentation
On Windows, these paths need to be provided by the user. You will need to find the include files and the library files...
Read more >
Error installing GeoPandas? - GIS Stack Exchange
The problem is with fiona not with shapely , try to install it separately not as a dependence of geopandas. Download the right...
Read more >
Cannot Open the file because the file path is more than 218 ...
Microsoft Excel: 218 characters. Microsoft Windows standard file path limit is 259-characters which means rule may apply to other type file (e,g ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found