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

Windows 64-bit error in segment.featurespeed.extract #813

Closed
matthew-brett opened this Issue Dec 16, 2015 · 5 comments

Comments

Projects
None yet
4 participants
@matthew-brett
Member

matthew-brett commented Dec 16, 2015

======================================================================
ERROR: dipy.segment.tests.test_feature.test_feature_extract
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\buildslaves\mike-win7-64\dipy-bdist64-27\build\venv\lib\site-packages\nose\case.py", line 197, in runTest
    self.test(*self.arg)
  File "C:\buildslaves\mike-win7-64\dipy-bdist64-27\build\venv\lib\site-packages\dipy\segment\tests\test_feature.py", line 231, in test_feature_extract
    features = extract(feature, streamlines)
  File "dipy\segment\featurespeed.pyx", line 371, in dipy.segment.featurespeed.extract (dipy\segment\featurespeed.c:6302)
  File "dipy\segment\featurespeed.pyx", line 394, in dipy.segment.featurespeed.extract (dipy\segment\featurespeed.c:5973)
  File "dipy\segment\featurespeed.pyx", line 363, in dipy.segment.featurespeed.infer_shape (dipy\segment\featurespeed.c:5661)
  File "dipy\segment\featurespeed.pyx", line 46, in dipy.segment.featurespeed.Feature.c_infer_shape (dipy\segment\featurespeed.c:2597)
TypeError: object of type 'long' has no len()

See: http://nipy.bic.berkeley.edu/builders/dipy-bdist64-27/builds/9/steps/shell_11/logs/stdio

One error in series reported at gh-803

@Garyfallidis

This comment has been minimized.

Member

Garyfallidis commented Dec 28, 2015

Hi @MarcCote this is an error that fails only in a few windows machines. You may not have a windows machine or access to a buildbot to play with this right now but I can fix or help you fix this if you give me some feedback with the following.

Basically, in featurespeed.pyx you check in line 44 if the type(shape) is int. But some times this type may come as long. Because in this buildbot
http://nipy.bic.berkeley.edu/builders/dipy-bdist64-27/builds/14/steps/shell_11/logs/stdio
the shape comes as long you immediately jump to line 46 where you expect to check something that you can apply a len to.

Now we could just go and replace in line 44 the existing line if type(shape) is int: with if type(shape) in [int, long] but maybe there is a safer/better way. What do you think?

@matthew-brett

This comment has been minimized.

Member

matthew-brett commented Dec 31, 2015

How about:

try:
    ndim = len(shape)
except TypeError:
    return tuple2shape((1, shape))

instead of:

            if type(shape) is int:
                return tuple2shape((1, shape))

I guess this function doesn't have to be super fast.

@MarcCote

This comment has been minimized.

Contributor

MarcCote commented Jan 7, 2016

I don't have access to a windows machine right now. If someone want to test it before merging, see PR #829.

@arokem

This comment has been minimized.

Member

arokem commented Jan 7, 2016

http://nipy.bic.berkeley.edu/builders/dipy-bdist64-27/builds/20

On Thu, Jan 7, 2016 at 9:25 AM, Marc-Alexandre Côté <
notifications@github.com> wrote:

I don't have access to a windows machine right now. If someone want to
test it before merging, see PR #829
#829.


Reply to this email directly or view it on GitHub
#813 (comment).

@arokem

This comment has been minimized.

Member

arokem commented Jan 7, 2016

Using "try_branch"':
https://github.com/nipy/nibotmi/blob/master/try_branch.py

On Thu, Jan 7, 2016 at 9:32 AM, Ariel Rokem arokem@gmail.com wrote:

http://nipy.bic.berkeley.edu/builders/dipy-bdist64-27/builds/20

On Thu, Jan 7, 2016 at 9:25 AM, Marc-Alexandre Côté <
notifications@github.com> wrote:

I don't have access to a windows machine right now. If someone want to
test it before merging, see PR #829
#829.


Reply to this email directly or view it on GitHub
#813 (comment).

arokem added a commit that referenced this issue Jan 12, 2016

Merge pull request #829 from MarcCote/fix_issue813_windows_error
Fixes issue #813 by not checking data type explicitly.

@MarcCote MarcCote closed this May 23, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment