question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add method returns a list on adding one file

See original GitHub issue

Adding one file user expects dict-type return (unfolded from original list-type response by stream decorer), but if ipfs provider proceed request with error (even it’s not critical) he got a list like its shown below.

>>> ipfsapi.connect('http://127.0.0.1', 5001).add('./myfile')
[{'Name': 'myfile', 'Hash': 'QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH', 'Size': '6'},
{'Message': 'cannot store pin state: write /var/lib/ipfs/datastore/000014.log: no space left on device', 'Code': 0, 'Type': 'error'}]

If user adding a directory he also get a list longer than expected.

>>> ipfsapi.connect('http://127.0.0.1', 5001).add('./mydir')
[{'Name': 'mydir/myfile2', 'Hash': 'QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH', 'Size': '6'},
{'Name': 'mydir/myfile1', 'Hash': 'QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH', 'Size': '6'},
{'Name': 'mydir', 'Hash': 'Qmaqk3vCjaXMJf6HqeV7aTRvHZpELsJNRWU7WgFJ4Z9M9X', 'Size': '114'},
{'Message': 'cannot store pin state: write /var/lib/ipfs/datastore/000014.log: no space left on device', 'Code': 0, 'Type': 'error'}]

Maybe there is a better place for error messages to let add return expected type / size?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ntninjacommented, Feb 13, 2019

Fixed by the exception handling part in #166 and making the number of return values explicitly defined in #167

1reaction
ntninjacommented, Dec 17, 2018

Thank you! I cannot formally assign this to you on GitHub atm, but definitely fell free to work on this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding items from a different file and storing them in another ...
In ArrayList, you need to call get method with index of object that you want access. Instead of ProductList(i) in getProduct method, ...
Read more >
Python's .append(): Add Items to Your Lists in Place
In this step-by-step tutorial, you'll learn how Python's .append() works and how to use it for adding items to your list in place....
Read more >
Set add() method in Java with Examples - GeeksforGeeks
The add() method of Set in Java is used to add a specific element into a Set collection. The function adds the element...
Read more >
How To add Elements to a List in Python - DigitalOcean
There are four methods to add elements to a List in Python. ... This function adds a single element to the end of...
Read more >
Append in Python – How to Append to a List or an Array
The .append() method adds an additional element to the end of an already existing list. The general syntax looks something like this: list_name ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found