PYBD OSError: [Errno 22] EINVAL

The official PYBD running MicroPython, and its accessories.
Target audience: Users with a PYBD
Post Reply
EduardoDestefani
Posts: 4
Joined: Thu Jul 02, 2020 8:17 pm

PYBD OSError: [Errno 22] EINVAL

Post by EduardoDestefani » Wed Sep 16, 2020 1:40 pm

Hello,

I was recently making a Web server for the Pyboard-D SF2W + magnetometer.

The software consists of sending a web page for the user to fill, in the indicated fields, the number of measures and the delay between them. The software receives these values ​​and starts recording the sensor's magnetic field readings in a file (.csv). After all measurements are made, it makes the .csv file available for download via the web interface.

The line indicated by the ERROR is responsible for recording the readings in the .csv file (the problem is not in the line, as it normally works in simple reading software without web service).

I can't understand why this "OSError: [Errno 22] EINVAL". Would anyone know if the problem is the code or a board limitation?

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: PYBD OSError: [Errno 22] EINVAL

Post by jimmo » Wed Sep 16, 2020 1:53 pm

EduardoDestefani wrote:
Wed Sep 16, 2020 1:40 pm
Would anyone know if the problem is the code or a board limitation?
Hi,
What you're doing should definitely be possible. Is it possible to share your code (or at least some relevant snippets) to help understand a bit more what might be going wrong? How does the webserver work? Are you using one of the existing libraries (e.g. microdot?)
Thanks

EduardoDestefani
Posts: 4
Joined: Thu Jul 02, 2020 8:17 pm

Re: PYBD OSError: [Errno 22] EINVAL

Post by EduardoDestefani » Wed Sep 16, 2020 3:50 pm

Is it possible to share your code (or at least some relevant snippets) to help understand a bit more what might be going wrong?
I just created a public repository, link to the code ; https://github.com/EduardoDestefani/mic ... er_v0.3.py
How does the webserver work?
The Web server consists of; send an html page with fields to be filled in by the user. The completed values ​​(Number of measurements and Delay between readings) are read and passed to the EdgComp part of the code. In this step, Pyboard records the magnetometer readings in a .csv file, when the number of measurements is equal to the number chosen by the user, the file is closed. To download the file, the user must click on "Download readings (.csv)". This action causes Pyboard to send the .csv file in addition to the html.
Are you using one of the existing libraries (e.g. microdot?)
I don't know this library :shock: . I am exclusively using the socket and ure to read and send information to the web page.

Thanks

Post Reply