-
Notifications
You must be signed in to change notification settings - Fork 277
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
drop last bits of python 2 #659
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cehbrecht
approved these changes
Feb 20, 2020
@tomkralidis I'm ok with dropping Python 3.5. What do you think? |
@ocefpaf merged. Thanks :) |
tlvu
added a commit
to Ouranosinc/pavics-sdi
that referenced
this pull request
Apr 28, 2020
…tead of string New owslib 0.19.2 (we had 0.19.1 before) deprecated python 2 so responses are now bytes instead of string. See PR geopython/OWSLib#659 or commit geopython/OWSLib@79f9430. Fix the following Jenkins error: ``` 12:25:22 ______ pavics-sdi-master/docs/source/notebooks/WFS_example.ipynb::Cell 3 _______ 12:25:22 Notebook cell execution failed 12:25:22 Cell 3: Cell execution caused an exception 12:25:22 12:25:22 Input: 12:25:22 layer_id = 'public:canada_admin_boundaries' 12:25:22 meta = wfs.contents[layer_id] 12:25:22 print(meta.title) 12:25:22 12:25:22 # Get the actual data 12:25:22 data = wfs.getfeature(typename='public:canada_admin_boundaries', bbox=(-74.5, 45.2, -73, 46), outputFormat='JSON') 12:25:22 12:25:22 # Write to file 12:25:22 fn = 'output.geojson' 12:25:22 with open(fn, 'w', encoding="utf-8") as fh: 12:25:22 fh.write(data.read()) 12:25:22 12:25:22 Traceback: 12:25:22 12:25:22 --------------------------------------------------------------------------- 12:25:22 TypeError Traceback (most recent call last) 12:25:22 <ipython-input-4-9fde860af399> in <module> 12:25:22 9 fn = 'output.geojson' 12:25:22 10 with open(fn, 'w', encoding="utf-8") as fh: 12:25:22 ---> 11 fh.write(data.read()) 12:25:22 12:25:22 TypeError: write() argument must be str, not bytes 12:25:22 12:25:22 ______ pavics-sdi-master/docs/source/notebooks/WFS_example.ipynb::Cell 4 _______ 12:25:22 Notebook cell execution failed 12:25:22 Cell 4: Cell execution caused an exception 12:25:22 12:25:22 Input: 12:25:22 layers = gpd.read_file(fn) 12:25:22 layers.plot() 12:25:22 12:25:22 Traceback: 12:25:22 12:25:22 --------------------------------------------------------------------------- 12:25:22 CPLE_OpenFailedError Traceback (most recent call last) 12:25:22 fiona/_shim.pyx in fiona._shim.gdal_open_vector() 12:25:22 12:25:22 fiona/_err.pyx in fiona._err.exc_wrap_pointer() 12:25:22 12:25:22 CPLE_OpenFailedError: 'output.geojson' not recognized as a supported file format. 12:25:22 12:25:22 During handling of the above exception, another exception occurred: 12:25:22 12:25:22 DriverError Traceback (most recent call last) 12:25:22 <ipython-input-5-13d953acb915> in <module> 12:25:22 ----> 1 layers = gpd.read_file(fn) 12:25:22 2 layers.plot() 12:25:22 12:25:22 /usr/local/envs/birdy/lib/python3.7/site-packages/geopandas/io/file.py in read_file(filename, bbox, mask, rows, **kwargs) 12:25:22 87 12:25:22 88 with fiona_env(): 12:25:22 ---> 89 with reader(path_or_bytes, **kwargs) as features: 12:25:22 90 12:25:22 91 # In a future Fiona release the crs attribute of features will 12:25:22 12:25:22 /usr/local/envs/birdy/lib/python3.7/site-packages/fiona/env.py in wrapper(*args, **kwargs) 12:25:22 396 def wrapper(*args, **kwargs): 12:25:22 397 if local._env: 12:25:22 --> 398 return f(*args, **kwargs) 12:25:22 399 else: 12:25:22 400 if isinstance(args[0], str): 12:25:22 12:25:22 /usr/local/envs/birdy/lib/python3.7/site-packages/fiona/__init__.py in open(fp, mode, driver, schema, crs, encoding, layer, vfs, enabled_drivers, crs_wkt, **kwargs) 12:25:22 252 if mode in ('a', 'r'): 12:25:22 253 c = Collection(path, mode, driver=driver, encoding=encoding, 12:25:22 --> 254 layer=layer, enabled_drivers=enabled_drivers, **kwargs) 12:25:22 255 elif mode == 'w': 12:25:22 256 if schema: 12:25:22 12:25:22 /usr/local/envs/birdy/lib/python3.7/site-packages/fiona/collection.py in __init__(self, path, mode, driver, schema, crs, encoding, layer, vsi, archive, enabled_drivers, crs_wkt, ignore_fields, ignore_geometry, **kwargs) 12:25:22 152 if self.mode == 'r': 12:25:22 153 self.session = Session() 12:25:22 --> 154 self.session.start(self, **kwargs) 12:25:22 155 elif self.mode in ('a', 'w'): 12:25:22 156 self.session = WritingSession() 12:25:22 12:25:22 fiona/ogrext.pyx in fiona.ogrext.Session.start() 12:25:22 12:25:22 fiona/_shim.pyx in fiona._shim.gdal_open_vector() 12:25:22 12:25:22 DriverError: 'output.geojson' not recognized as a supported file format. ```
tlvu
added a commit
to Ouranosinc/pavics-sdi
that referenced
this pull request
Apr 28, 2020
…tead of string New owslib 0.19.2 (we had 0.19.1 before) dropped python 2 so responses are now bytes instead of string. See PR geopython/OWSLib#659 or commit geopython/OWSLib@79f9430. Fix the following Jenkins error: ``` 12:25:22 ______ pavics-sdi-master/docs/source/notebooks/WFS_example.ipynb::Cell 3 _______ 12:25:22 Notebook cell execution failed 12:25:22 Cell 3: Cell execution caused an exception 12:25:22 12:25:22 Input: 12:25:22 layer_id = 'public:canada_admin_boundaries' 12:25:22 meta = wfs.contents[layer_id] 12:25:22 print(meta.title) 12:25:22 12:25:22 # Get the actual data 12:25:22 data = wfs.getfeature(typename='public:canada_admin_boundaries', bbox=(-74.5, 45.2, -73, 46), outputFormat='JSON') 12:25:22 12:25:22 # Write to file 12:25:22 fn = 'output.geojson' 12:25:22 with open(fn, 'w', encoding="utf-8") as fh: 12:25:22 fh.write(data.read()) 12:25:22 12:25:22 Traceback: 12:25:22 12:25:22 --------------------------------------------------------------------------- 12:25:22 TypeError Traceback (most recent call last) 12:25:22 <ipython-input-4-9fde860af399> in <module> 12:25:22 9 fn = 'output.geojson' 12:25:22 10 with open(fn, 'w', encoding="utf-8") as fh: 12:25:22 ---> 11 fh.write(data.read()) 12:25:22 12:25:22 TypeError: write() argument must be str, not bytes 12:25:22 12:25:22 ______ pavics-sdi-master/docs/source/notebooks/WFS_example.ipynb::Cell 4 _______ 12:25:22 Notebook cell execution failed 12:25:22 Cell 4: Cell execution caused an exception 12:25:22 12:25:22 Input: 12:25:22 layers = gpd.read_file(fn) 12:25:22 layers.plot() 12:25:22 12:25:22 Traceback: 12:25:22 12:25:22 --------------------------------------------------------------------------- 12:25:22 CPLE_OpenFailedError Traceback (most recent call last) 12:25:22 fiona/_shim.pyx in fiona._shim.gdal_open_vector() 12:25:22 12:25:22 fiona/_err.pyx in fiona._err.exc_wrap_pointer() 12:25:22 12:25:22 CPLE_OpenFailedError: 'output.geojson' not recognized as a supported file format. 12:25:22 12:25:22 During handling of the above exception, another exception occurred: 12:25:22 12:25:22 DriverError Traceback (most recent call last) 12:25:22 <ipython-input-5-13d953acb915> in <module> 12:25:22 ----> 1 layers = gpd.read_file(fn) 12:25:22 2 layers.plot() 12:25:22 12:25:22 /usr/local/envs/birdy/lib/python3.7/site-packages/geopandas/io/file.py in read_file(filename, bbox, mask, rows, **kwargs) 12:25:22 87 12:25:22 88 with fiona_env(): 12:25:22 ---> 89 with reader(path_or_bytes, **kwargs) as features: 12:25:22 90 12:25:22 91 # In a future Fiona release the crs attribute of features will 12:25:22 12:25:22 /usr/local/envs/birdy/lib/python3.7/site-packages/fiona/env.py in wrapper(*args, **kwargs) 12:25:22 396 def wrapper(*args, **kwargs): 12:25:22 397 if local._env: 12:25:22 --> 398 return f(*args, **kwargs) 12:25:22 399 else: 12:25:22 400 if isinstance(args[0], str): 12:25:22 12:25:22 /usr/local/envs/birdy/lib/python3.7/site-packages/fiona/__init__.py in open(fp, mode, driver, schema, crs, encoding, layer, vfs, enabled_drivers, crs_wkt, **kwargs) 12:25:22 252 if mode in ('a', 'r'): 12:25:22 253 c = Collection(path, mode, driver=driver, encoding=encoding, 12:25:22 --> 254 layer=layer, enabled_drivers=enabled_drivers, **kwargs) 12:25:22 255 elif mode == 'w': 12:25:22 256 if schema: 12:25:22 12:25:22 /usr/local/envs/birdy/lib/python3.7/site-packages/fiona/collection.py in __init__(self, path, mode, driver, schema, crs, encoding, layer, vsi, archive, enabled_drivers, crs_wkt, ignore_fields, ignore_geometry, **kwargs) 12:25:22 152 if self.mode == 'r': 12:25:22 153 self.session = Session() 12:25:22 --> 154 self.session.start(self, **kwargs) 12:25:22 155 elif self.mode in ('a', 'w'): 12:25:22 156 self.session = WritingSession() 12:25:22 12:25:22 fiona/ogrext.pyx in fiona.ogrext.Session.start() 12:25:22 12:25:22 fiona/_shim.pyx in fiona._shim.gdal_open_vector() 12:25:22 12:25:22 DriverError: 'output.geojson' not recognized as a supported file format. ```
tlvu
added a commit
to Ouranosinc/pavics-sdi
that referenced
this pull request
Apr 29, 2020
…-jupyter-env Update notebooks to match new Jupyter env. To match new Jupyter env in PR Ouranosinc/PAVICS-e2e-workflow-tests#43. New owslib 0.19.2 (we had 0.19.1 before) dropped the remaining of python 2 support so responses are now bytes instead of string. See PR geopython/OWSLib#659 or commit geopython/OWSLib@79f9430. I wouldn't expect a patch version release to drop python 2 support ! New xarray 0.15.1 default to html style output that allows collapsing/expanding data, see PR pydata/xarray#3812 or commit pydata/xarray@b155853. ![2020-04-28-134427_536x549_scrot](https://user-images.githubusercontent.com/11966697/80519794-89c80000-8956-11ea-8f0d-b95360b2d46c.png) Unfortunately had to force the old text style since the html style has randomness that breaks automated testing of the notebooks using nbval pytest plugin. Finally a passing Jenkins run: http://jenkins.ouranos.ca/job/PAVICS-e2e-workflow-tests/job/new-docker-release-for-xclim/5/console
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a bit more complicated than it looks and you may delay the merge until OWSLib is ready to drop Python 3.5 support too.
The reason is that, with this PR, some responses are no longer converted to
str
. The main advantage is that everything is bytes in a way we expected from Python 3. The downside is that Python 3.5json
module cannot handle bytes, that started in 3.6, and some users may still expectstr
rather than bytes in their workflow. (See the docs test where I had to add theb""
as an example of that.)