Skip to content
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

Problem with downloads on Windows machine #253

Open
dspeterka opened this issue Jan 20, 2017 · 3 comments
Open

Problem with downloads on Windows machine #253

dspeterka opened this issue Jan 20, 2017 · 3 comments
Labels

Comments

@dspeterka
Copy link

ndio version os python
Ndio version 1.1.5 Windows 7 Python 3.5.2.4 (WinPython-64bit-3.5.2.3Qt5)

Ndio version 1.1.5, Windows 7, Python 3.5.2.4 (WinPython-64bit-3.5.2.3Qt5)

On trying the demos on https://github.com/neurodata/ndio-demos/blob/master/Datasets/Weiler%20et%20al%20%282014%29%20%E2%80%94%20Chessboard.ipynb and https://github.com/neurodata/ndio-demos/blob/master/Getting%20Started.ipynb

python throws an error being unable to have permissions to read the temp file (allegedly) written by the query request. Seems like the file isn't actually being written in the first place. Directory is a temp dir, where all window objects have permissions to write. Account has administrator privileges as well. Perhaps just a problem in my set-up, but consistent on 3 machines with same nominal versions.

import ndio
import ndio.remote.neurodata as neurodata
nd = neurodata()
token = 'kasthuri11'
channels = nd.get_channels(token)

query = { 'token': token, 'channel': 'image', 'x_start': 1000, 'x_stop': 1300, 'y_start': 2000, 'y_stop': 2400, 'z_start': 1100, 'z_stop': 1150, 'resolution': 3 }

example_volume = nd.get_cutout(**query)

Last line throws the error, included below:

`OSError Traceback (most recent call last)
in ()
----> 1 example_volume = nd.get_cutout(**query)

X:\usr\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\lib\site-packages\ndio\remote\neurodata.py in wrapped(self, *args, **kwargs)
95 else:
96 self._known_tokens.append(token)
---> 97 return f(self, *args, **kwargs)
98 return wrapped
99

X:\usr\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\lib\site-packages\ndio\remote\neurodata.py in get_cutout(self, token, channel, x_start, x_stop, y_start, y_stop, z_start, z_stop, resolution, block_size, neariso)
551 x_start, x_stop,
552 y_start, y_stop,
--> 553 z_start, z_stop, neariso=neariso)
554 vol = numpy.rollaxis(vol, 1)
555 vol = numpy.rollaxis(vol, 2)

X:\usr\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\lib\site-packages\ndio\remote\neurodata.py in _get_cutout_no_chunking(self, token, channel, resolution, x_start, x_stop, y_start, y_stop, z_start, z_stop, neariso)
608 tmpfile.write(req.content)
609 tmpfile.seek(0)
--> 610 h5file = h5py.File(tmpfile.name, "r")
611 return h5file.get(channel).get('CUTOUT')[:]
612 raise IOError("Failed to make tempfile.")

X:\usr\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\lib\site-packages\h5py_hl\files.py in init(self, name, mode, driver, libver, userblock_size, swmr, **kwds)
264
265 fapl = make_fapl(driver, libver, **kwds)
--> 266 fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
267
268 if swmr_support:

X:\usr\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\lib\site-packages\h5py_hl\files.py in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)
94 if swmr and swmr_support:
95 flags |= h5f.ACC_SWMR_READ
---> 96 fid = h5f.open(name, flags, fapl=fapl)
97 elif mode == 'r+':
98 fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)

h5py_objects.pyx in h5py._objects.with_phil.wrapper (D:\Build\h5py\h5py-git\h5py_objects.c:2703)()

h5py_objects.pyx in h5py._objects.with_phil.wrapper (D:\Build\h5py\h5py-git\h5py_objects.c:2661)()

h5py\h5f.pyx in h5py.h5f.open (D:\Build\h5py\h5py-git\h5py\h5f.c:1970)()

OSError: Unable to open file (Unable to open file: name = 'x:\temp\tmp5cti_bd6', errno = 13, error message = 'permission denied', flags = 0, o_flags = 0)
`

@kunallillaney
Copy link
Collaborator

tempfile.NamedTemporaryFile is not supported on Windows NT or later.

@dspeterka
Copy link
Author

Switching line 607 of neurodata.py from
with tempfile.NamedTemporaryFile() as tmpfile:
to
with tempfile.NamedTemporaryFile(delete=False) as tmpfile:
fixes this, but at a cost of having to manually delete up tmp files. Gets me by in the meantime...

@kunallillaney
Copy link
Collaborator

@dspeterka thanks for the update. We will document this and update this in the future. The git issue servers as a good documentation point.

@Aeusman Aeusman added docs and removed bug labels Mar 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants