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:
- Created 6 years ago
- Comments:17 (13 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m way behind on ev3dev-Python lately but the proposed idea sounds like a good idea to me
Of course it is. In the original implementation it was an
Exception
which is a superclass ofOSError
(which I marked as erroneous), which is more generic. The error is obviously aValueError
so the exception should be at least aValueError
if not a subclass. I am happy to see that this is fixed with https://github.com/rhempel/ev3dev-lang-python/commit/b009e9eb1f0f4945b9b9e45f2c2a5491c41776a6The 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.