GithubHelp home page GithubHelp logo

Comments (5)

jgrewe avatar jgrewe commented on September 18, 2024

Hi Ajay,
unfortunately I cannot reproduce this bug. The following code throws the expected Exception:

import nix
f = nix.File.open('test.h5', nix.FileMode.Overwrite) 
f.create_block('Test', 'test_type')
for i in range(100):
    try:
        f.create_block('Test', 'test_type')
    except Exception, e:
       print(str(i) + ':  ' + str(e))

0: Duplicate name given - names have to be unique for a given entity type & parent. (createBlock)
1: Duplicate name given - names have to be unique for a given entity type & parent. (createBlock)
2: Duplicate name given - names have to be unique for a given entity type & parent. (createBlock)
3: Duplicate name given - names have to be unique for a given entity type & parent. (createBlock)
4: Duplicate name given - names have to be unique for a given entity type & parent. (createBlock)
5: Duplicate name given - names have to be unique for a given entity type & parent. (createBlock)

...

96: Duplicate name given - names have to be unique for a given entity type & parent. (createBlock)
97: Duplicate name given - names have to be unique for a given entity type & parent. (createBlock)
98: Duplicate name given - names have to be unique for a given entity type & parent. (createBlock)
99: Duplicate name given - names have to be unique for a given entity type & parent. (createBlock)

Could you try this out or provide a code snippet that produces the error?

Best,
Jan

from nixpy.

jgrewe avatar jgrewe commented on September 18, 2024

Ups, at least half of my brain was asleep... However, the same is holds for multi_tags:

 import numpy as np 
 import nix
 f = nix.File.open('test.h5', nix.FileMode.Overwrite)
 x = np.random.randn(1000)
 b = f.create_block('Test', 'test')
 da = b.create_data_array('test', 'test', data=x)
 b.create_multi_tag('test','test_type', da)
 for i in range(100):
    try:
           b.create_multi_tag('test', 'test_type', da)
    except Exception, e:
           print(str(i) + ':  ' + str(e))

gives me 100 correct exceptions.

from nixpy.

balint42 avatar balint42 commented on September 18, 2024

Yes this I think is correct behaviour. The reason is as written in the message. Or do we misunderstand your problem?

from nixpy.

ajkswamy avatar ajkswamy commented on September 18, 2024

Hello Jan and Balint

Here is a small test class(testFile.py) and test script(testMultipleRuns.py).

https://copy.com/uqN1iXlyIQTR0s7G

It seems that the error message depends on the commands which are run before attempting to add a duplicate-name multitag.

Maybe there is something wrong in the way I am using NIX. If so, I would appeciate your suggestions.

Thanks and Cheers
Ajay

from nixpy.

jgrewe avatar jgrewe commented on September 18, 2024

Hi Ajay, after some digging I gave up on finding the cause for this problem. On the C++ side, the exceptions are correctly thrown and contain a correct error message. On the python side they sometimes loose their messages.
I created explicit transforms that map the nix::C++ exceptions to python errors. In case of empty messages, a standard error message is provided giving at least an idea what went wrong. (see pull request #119.

Thanks again for your bug report and the code!

from nixpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.