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.

OSError when setting too large speed_sp

See original GitHub issue
  • ev3dev version: 4.4.68-20-ev3dev-ev3

One of my students ran into an issue where they set motor.run_forever for a large motor via a formula. Once the result reached 1050 they got a OSError: InvalidArgument. 1050 is the max_speed. I think the library should cap the input at 1050 (or the max_speed of the corresponding tacho-motor) or throw a ValueError instead. The error message, in any way, is very cryptic considering how easy it is to trigger.

speed_R was set to something larger than the max_speed.

Traceback (most recent call last):
  File "./braitenberg4b.py", line 26, in <module>
    motor_R.run_forever(speed_sp = speed_R)
  File "/usr/lib/python3/dist-packages/ev3dev/core.py", line 793, in run_forever
    setattr(self, key, kwargs[key])
  File "/usr/lib/python3/dist-packages/ev3dev/core.py", line 583, in speed_sp
    self._speed_sp = self.set_attr_int(self._speed_sp, 'speed_sp', value)
  File "/usr/lib/python3/dist-packages/ev3dev/core.py", line 217, in set_attr_int
    return self._set_attribute(attribute, name, str(int(value)))
  File "/usr/lib/python3/dist-packages/ev3dev/core.py", line 206, in _set_attribute
    attribute.write(value.encode())
OSError: [Errno 22] Invalid argument

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
dwalton76commented, Aug 31, 2017

I’m way behind on ev3dev-Python lately but the proposed idea sounds like a good idea to me

0reactions
mawekicommented, Aug 21, 2017

it isn’t an even more generic Exception

Of course it is. In the original implementation it was an Exception which is a superclass of OSError (which I marked as erroneous), which is more generic. The error is obviously a ValueError so the exception should be at least a ValueError if not a subclass. I am happy to see that this is fixed with https://github.com/rhempel/ev3dev-lang-python/commit/b009e9eb1f0f4945b9b9e45f2c2a5491c41776a6

The error message is nice and all, but I was concerned with the correct type of exception.

You can ignore the other comment. I was mistaken there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting around OSError 'File too large' with 4GB writing limit in ...
I'm combining ~200 csv files (most 10 to 200 MB) into a single file on a flash drive using chunking (with Python 3.7.6...
Read more >
How to Solve the "413 Request Entity Too Large" Error - Kinsta
It happens when a client makes a request that's too large for the end server to process.
Read more >
kernel - "Argument list too long": How do I deal with it, without ...
I know why this happens: it is because there is a kernel limit on the amount of space for arguments to a command....
Read more >
How to Solve Proxy Error Codes - The Ultimate Guide!
This error is likely to be received when sending too many requests within a limited time frame while using the same IP address....
Read more >
How to Fix the 'Too Many Open Files' Error in Linux?
Very often 'too many open files' errors occur on high-load Linux servers. ... and how to change this setting globally for the entire...
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