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

file read issue on Windows #18

Closed
dyf opened this issue Aug 28, 2015 · 5 comments
Closed

file read issue on Windows #18

dyf opened this issue Aug 28, 2015 · 5 comments

Comments

@dyf
Copy link

dyf commented Aug 28, 2015

The recent merge from nocnokneo seems to have reintroduced a Windows file reading bug. Here's the error:

C:\Anaconda\python.exe C:/Users/user/PycharmProjects/MyFirstAllenBrain/Test.py
Traceback (most recent call last):
File "C:/Users/user/PycharmProjects/MyFirstAllenBrain/Test.py", line 14, in
pd = mcc.get_projection_density(experiments[0]['id'])
File "C:\Users\user\AppData\Roaming\Python\Python27\site-packages\allensdk\core\mouse_connectivity_cache.py", line 170, in get_projection_density
return nrrd.read(file_name)
File "C:\Anaconda\lib\site-packages\nrrd.py", line 384, in read
data = read_data(header, filehandle, filename)
File "C:\Anaconda\lib\site-packages\nrrd.py", line 235, in read_data
mmap.MAP_PRIVATE, mmap.PROT_READ)
AttributeError: 'module' object has no attribute 'MAP_PRIVATE'

Process finished with exit code 1

I believe MAP_PRIVATE is a linux-specific attribute, but I'm not sure about this.

Related stackoverflow question: http://stackoverflow.com/questions/32261480/allen-brain-institute-mouse-connectivity-api-and-mouse-connectivity-cache-exam/32279226#32279226

@mhe
Copy link
Owner

mhe commented Aug 29, 2015

Thanks for reporting this. I will investigate.

mhe added a commit that referenced this issue Aug 29, 2015
@mhe
Copy link
Owner

mhe commented Aug 29, 2015

@dyf I made a first attempt at a fix in the mmap-windows branch. Unfortunately this was a 'blind' fix: I do not have access to a windows machine at the moment to be able to properly test it. If someone in the meantime is able to test this on a windows machine: let me know the results.

@dyf
Copy link
Author

dyf commented Aug 29, 2015

Thanks, getting closer. I'm able to read the downloaded file with open(...), but get the following error with your updated pynrrd:

C:\Users\davidf\Anaconda\lib\site-packages\allensdk\core\mouse_connectivity_cache.pyc in get_projection_density(self, experiment_id, file_name)
168 self.api.download_projection_density(file_name, experiment_id, self.resolution)
169
--> 170 return nrrd.read(file_name)
171
172

C:\Users\davidf\Anaconda\lib\site-packages\nrrd.pyc in read(filename)
386 with open(filename,'rb') as filehandle:
387 header = read_header(filehandle)
--> 388 data = read_data(header, filehandle, filename)
389 return (data, header)
390

C:\Users\davidf\Anaconda\lib\site-packages\nrrd.pyc in read_data(fields, filehandle, filename, seek_past_header)
233 datafilehandle.seek(0)
234 if os.name == "nt":
--> 235 m = mmap.mmap(datafilehandle.fileno(), 0)
236 else:
237 m = mmap.mmap(datafilehandle.fileno(), 0,

WindowsError: [Error 5] Access is denied

@mhe
Copy link
Owner

mhe commented Sep 3, 2015

I'm still doing this 'blind', but I've made slight modification in the same branch. It could be that the code I initially created to fix this requested write access to the file. Perhaps this fixes the issue.

@dyf
Copy link
Author

dyf commented Sep 10, 2015

Looks like it's working now. Thanks for the quick turnaround!

@dyf dyf closed this as completed Sep 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants