-
Notifications
You must be signed in to change notification settings - Fork 264
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
Python 3 problems with versions > 1.1.6 #485
Comments
Confirmed. Don't understand why the context manager or the garbage collector should behave differently in 3.4 though. |
Don't believe it has anything to do with the context manager or garbage collection. Even if I modify your script to just open the file and try to modify the attributes, it segfaults with python 3.4 (but not 2.7).
|
Probably related to pull request #389. Even though the attributes are stored as ascii text in the original file, they are written as strings in python 3, and the C lib does not like overwriting a text attribute with a vlen string. |
Note that replacing
with
fixes the segfault on python 3.4, confirming the problem is associated with trying to write the attribute as a string and not text. |
@shoyer, do you have any thoughts on how to handle this? |
Well, the C lib should probably not be crashing when you ask it to set an attribute to a new type :). I assume this also happens if you try to do other types of attribute type conversion? One sensible approach would be to delete and recreate attributes if they exist but have a different type before attempting to set them. |
The C lib appears able to handle conversions of numeric types, just not text to strings.
|
workaround for C lib bug discovere in Issue #485
Appending to a file using a context manager seems to close the
Dataset
(or it gets garbaged collected) before completing, usually resulting in a segfault.This may have to do with #251.
I've used
1.1.6
for a long awhile now (it "just works" for me) and I was trying to upgrade things to 1.2.1 (so I can use the now built-inget_variables_by_attributes
).Here is a simple script to demonstrate. File to go along with script (looks in the same directory for it). Everything works fine with Python
2.7
, but fails with Python3.4
when thenetcdf4-python
version is above1.1.6
. I didn't test1.1.7
because that release never made it toconda
.The text was updated successfully, but these errors were encountered: