nipy/niwidgets

path import issue

dgutman opened this issue · 1 comments

I am getting an error related to specifying a path.

TypeError: argument should be string, bytes or integer, not PosixPath

This was with the pip install niwidgets basic installation; I had trouble with this on 2.7.2 so I switched my kernel to 3.5.3 and am still having the same issue...


TypeError Traceback (most recent call last)
in ()
5 import ipywidgets as widgets
6 ###http://nipy.org/niwidgets/installation.html#install-via-pip
----> 7 my_widget = NiftiWidget('../SampleDataFiles/fdt_paths.nii.gz')
8 get_ipython().run_line_magic('load_ext', 'autoreload')
9 get_ipython().run_line_magic('autoreload', '2')

~/.virtualenvs/nipypev3/lib/python3.5/site-packages/niwidgets/niwidget_volume.py in init(self, filename)
43 """
44 self.filename = Path(filename).resolve()
---> 45 if not os.path.isfile(self.filename):
46 raise OSError('File ' + self.filename.name + ' not found.')
47

~/.virtualenvs/nipypev3/lib/python3.5/genericpath.py in isfile(path)
28 """Test whether a path is a regular file"""
29 try:
---> 30 st = os.stat(path)
31 except OSError:
32 return False

TypeError: argument should be string, bytes or integer, not PosixPath

This should be fixed since commit 4b19e05 (and in the latest version on pypi), but let me know if you have any more problems.