dvrhax / uPyMySQL

Pure uPython MySQL Client
MIT License
23 stars 6 forks source link

cannot import name Connection #1

Closed BryanSouza91 closed 3 weeks ago

BryanSouza91 commented 4 years ago

Hello,

thanks so much for porting this package.

I have a little program written to read an IMU and log it to a database.

ESP-32 and LSM303DLHC MySQL running on desktop on localhost through XAMPP

I have checked all of my code three times just to be sure, here is the part of my code(line 16 in error below) that is based on your example: connection = upymysql.connect(host='192.168.1.10', user='bryan', password=password, db='micropython_data', charset='utf8_general_ci', cursorclass=upymysql.cursors.DictCursor)

here is the error: network config: ('192.168.1.253', '255.255.255.0', '192.168.1.1', '192.168.1.1') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<string>", line 16, in <module> File "upymysql/__init__.py", line 263, in Connect ImportError: cannot import name Connection

any input would would be greatly appreciated. Thank you, Bryan

aadvanes commented 4 years ago

Hello I have the same issue. I think something to do with the installation? What did I do wrong?

I execute following code on ESP8266 after copying the .\uPyMySQL\upymysql directory in the root of ESP8266.

Connect to the database

import pymysql.cursors mariadb_connection = pymysql.connect(host='192.168.0.112', user='aad', password='aad', db='test01', charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor)

The REPL tells me:

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── MicroPython v1.12 on 2019-12-20; ESP module with ESP8266

Type "help()" for more information.

%Run -c $EDITOR_CONTENT Traceback (most recent call last): File "", line 3, in AttributeError: 'module' object has no attribute 'connect'

dvrhax commented 4 years ago

Bryan, I stripped most of the charsets out to get it small enough to fit on the ESP8266 that may be your problem. Try it with 'utf8mb4' and see if it works

Aadvanes, the example is a little outdated since I renamed the project upymsql from pymysql. Change all occurrences of pymysql to upymysql and make sure you start with:

import upymysql
import upymysql.cursors

Hopefully that will get you working

BryanSouza91 commented 4 years ago

I will give this a try in the next few days and report back! Thanks for checking this out!

aadvanes commented 4 years ago

Hi ,

That would be great. I tried to but I got stuck. Isn’t the file ‘Connect.py’ missing in Github?

Running the code:

Connect to the database

import upymysql import upymysql.cursors

mariadb_connection = upymysql.Connect(host='192.168.0.112', user='aad', password='aad', db='test01', charset='utf8mb4', cursorclass=upymysql.cursors.DictCursor)

Returns in an error:

MicroPython v1.12 on 2019-12-20; ESP module with ESP8266

Type "help()" for more information.

%Run -c $EDITOR_CONTENT Traceback (most recent call last): File "", line 6, in AttributeError: 'module' object has no attribute 'Connect'

Met vriendelijke groet, with kind regards, mit freundlichen Grüßen,

Aad van Es

From: BryanSouza91 notifications@github.com Sent: vrijdag 1 mei 2020 20:49 To: dvrhax/uPyMySQL uPyMySQL@noreply.github.com Cc: Es A. van (Aad) aad.vanes@vanoord.com; Comment comment@noreply.github.com Subject: Re: [dvrhax/uPyMySQL] cannot import name Connection (#1)

I will give this a try in the next few days and report back! Thanks for checking this out!

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdvrhax%2FuPyMySQL%2Fissues%2F1%23issuecomment-622513850&data=02%7C01%7Caad.vanes%40vanoord.com%7C5196f068f41c456ea53d08d7ee0057ee%7Cd62ada1bca424fe2b9e7ceb843af0ad2%7C0%7C0%7C637239557556353532&sdata=WQJmZa1VAZvxIVfKUQc6xYKhaYv46pAlwJ87dcTbia4%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAINIY4SMSMSJ5C7IRY6FKXTRPMKSRANCNFSM4JYBYP4Q&data=02%7C01%7Caad.vanes%40vanoord.com%7C5196f068f41c456ea53d08d7ee0057ee%7Cd62ada1bca424fe2b9e7ceb843af0ad2%7C0%7C0%7C637239557556353532&sdata=vCxZZ7tqtjPET4KobWtF82VK01oia1fMvJz5buOYvvQ%3D&reserved=0.

Disclaimer: This mail transmission and any attached files are confidential and are intended for the addressee only. If you are not the person or organization to whom it is addressed, you must not copy, disclose, distribute or take any action in reliance upon it. If you have received this message in error, please contact the sender by email and delete all copies of this message and all copies of any attached files.

sasilva1998 commented 4 years ago

Hi, I believe there could be also a memory problem, I am using a ESP32, and getting the following error when trying to import connections.py files, believe this is mostly because the script is just to long and ESP32 ram can't handle it, I wish I could help breaking it in pieces but now don't have much time, either way might try soon if not corrected before that.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
MemoryError: memory allocation failed, allocating 464 bytes

Great work by the way.

aadvanes commented 4 years ago

Could be RAM indeed. I am using ESP8266 which has less RAM.

Which module has Upymyspql been designed for, if even ESP32 is too small

Vriendelijke groeten,

Aad van Es

Op 2 mei 2020 om 21:22 heeft Steven A. Silva notifications@github.com het volgende geschreven:



Hi, I believe there could be also a memory problem, I am using a ESP32, and getting the following error when trying to import connections.py files, believe this is mostly because the script is just to long and ESP32 ram can't handle it, I wish I could help breaking it in pieces but now don't have much time, either way might try soon if not corrected before that.

Traceback (most recent call last): File "", line 1, in MemoryError: memory allocation failed, allocating 464 bytes

Great work by the way.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdvrhax%2FuPyMySQL%2Fissues%2F1%23issuecomment-623001566&data=02%7C01%7Caad.vanes%40vanoord.com%7C1b39e625ca6d4c97d05d08d7eece1bf0%7Cd62ada1bca424fe2b9e7ceb843af0ad2%7C0%7C0%7C637240441315812706&sdata=tHi1oXxMM7Nf3J2qjitdCRKVsLWH7D44l8lSruac%2Ffw%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAINIY4XUON4VKSP743RHRILRPRXGBANCNFSM4JYBYP4Q&data=02%7C01%7Caad.vanes%40vanoord.com%7C1b39e625ca6d4c97d05d08d7eece1bf0%7Cd62ada1bca424fe2b9e7ceb843af0ad2%7C0%7C0%7C637240441315812706&sdata=f%2BY8UzIAh5PHnxP0hOhjpgIa64diixNnpMfvfAnepU0%3D&reserved=0.

Disclaimer: This mail transmission and any attached files are confidential and are intended for the addressee only. If you are not the person or organization to whom it is addressed, you must not copy, disclose, distribute or take any action in reliance upon it. If you have received this message in error, please contact the sender by email and delete all copies of this message and all copies of any attached files.

sasilva1998 commented 4 years ago

I has happened to me before already with a ESP8266, which can't mostly import 350+ lines of code, but didn't except to have that problem with ESP32. Anyway a 1400+ lines for a script is a lot, might want to split it.

BryanSouza91 commented 4 years ago

This is the error msg I am receiving now, it is a MemoryError as well:

network config: ('192.168.1.253', '255.255.255.0', '192.168.1.1', '192.168.1.1')
Traceback (most recent call last):
  File "main.py", line 13, in <module>
  File "upymysql/__init__.py", line 88, in Connect
MemoryError: memory allocation failed, allocating 136 byte
MicroPython v1.11-580-g973f68780 on 2019-11-18; ESP32 module with ESP32
dvrhax commented 4 years ago

I haven't tried this with an esp32 but did have working on an esp8266 compiled into the firmware. I don't think it possible to get it working without compiling it in.

dvrhax commented 4 years ago

aadvanes Connect is a function in init.py line 85

sasilva1998 commented 4 years ago

@dvrhax Think maybe that could be the problem, haven't tried compiling it but will, I am not completely sure, but think that way it doesn't consume that much memory, will be give feedback when tried.

BryanSouza91 commented 4 years ago

Thanks for the info @dvrhax

I will try it on the ESP32 compiled in the firmware.

dvrhax commented 4 years ago

@sasilva1998 You may need to disable B-Tree in the build for the 8266. You can refer to here if you have any questions: https://forum.micropython.org/viewtopic.php?f=3&t=6007

aadvanes commented 4 years ago

Hello dvrahx

I compiled upymysql into the esp8266 port. Tnx for the link. Never done before. Tried to exclude ‘btree’, which did not work out well, but it looks like enough memory is available. Now running the original script:

import upymysql.cursors mariadb_connection = upymysql.Connect(host='192.168.0.112', user='aad', password='aad', db='test01', charset='utf8mb4', cursorclass=upymysql.cursors.DictCursor)

Gives the follow error. I don’t know what is wrong.

%Run -c $EDITOR_CONTENT [Errno 103] ECONNABORTED Traceback (most recent call last): File "", line 11, in File "upymysql/init.py", line 89, in Connect File "upymysql/connections.py", line 665, in init File "upymysql/connections.py", line 884, in connect AttributeError: 'module' object has no attribute 'EINTR'

Btw: these modules are now part of the firmware:

MicroPython v1.12-433-g25434e976-dirty on 2020-05-06; ESP module with ESP8266 Type "help()" for more information.

help('modules') main neopixel uheapq upymysql/optionfile _boot network uio upymysql/times _onewire ntptime ujson upymysql/util _uasyncio onewire uos urandom _webrepl port_diag upip ure apa102 sys upip_utarfile uselect btree uarray upymysql/init usocket builtins uasyncio/init upymysql/_socketio ussl dht uasyncio/core upymysql/charset ustruct ds18x20 uasyncio/event upymysql/connections utime esp uasyncio/funcs upymysql/constants/CLIENT utimeq flashbdev uasyncio/lock upymysql/constants/COMMAND uwebsocket framebuf uasyncio/stream upymysql/constants/CR uzlib gc ubinascii upymysql/constants/FIELD_TYPE webrepl inisetup ucollections upymysql/constants/FLAG webrepl_setup lwip ucryptolib upymysql/constants/SERVER_STATUS websocket_helper machine uctypes upymysql/constants/init math uerrno upymysql/converters micropython uhashlib upymysql/cursors Plus any modules on the filesystem

Met vriendelijke groet, with kind regards, mit freundlichen Grüßen,

Aad van Es

Research Specialist | Offshore Energy Research Van Oord Dredging and Marine Contractors

T: +31 (0)88 826 8294 M: +31 (6) 25 007 316 E: aad.vanes@vanoord.commailto:aad.vanes@vanoord.com

Our department has been relocated to Gorinchem, Jan Blankenweg 2. Please feel free to visit us in our new location: room O.125.

From: dvrhax notifications@github.com Sent: maandag 4 mei 2020 14:09 To: dvrhax/uPyMySQL uPyMySQL@noreply.github.com Cc: Es A. van (Aad) aad.vanes@vanoord.com; Comment comment@noreply.github.com Subject: Re: [dvrhax/uPyMySQL] cannot import name Connection (#1)

@sasilva1998https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsasilva1998&data=02%7C01%7Caad.vanes%40vanoord.com%7Cccd6c2facab2476f6c0408d7f023edd7%7Cd62ada1bca424fe2b9e7ceb843af0ad2%7C0%7C1%7C637241909418521408&sdata=PtQXpqo0gLyv%2BlkaeN9ImGHQMTiUYN%2Bv4QhFwGcf8no%3D&reserved=0 You may need to disable B-Tree in the build for the 8266. You can refer to here if you have any questions: https://forum.micropython.org/viewtopic.php?f=3&t=6007https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fforum.micropython.org%2Fviewtopic.php%3Ff%3D3%26t%3D6007&data=02%7C01%7Caad.vanes%40vanoord.com%7Cccd6c2facab2476f6c0408d7f023edd7%7Cd62ada1bca424fe2b9e7ceb843af0ad2%7C0%7C1%7C637241909418531404&sdata=Z3ljCruySLAo8t0hTkReE9iXZpjIl3b6xNLOz57u7Ks%3D&reserved=0

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdvrhax%2FuPyMySQL%2Fissues%2F1%23issuecomment-623425422&data=02%7C01%7Caad.vanes%40vanoord.com%7Cccd6c2facab2476f6c0408d7f023edd7%7Cd62ada1bca424fe2b9e7ceb843af0ad2%7C0%7C1%7C637241909418531404&sdata=y7zce4wB7aINWETIbAYDvhuiNcoHKX6eY%2FSeuLaYVuE%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAINIY4UGADE4POTVH7PMIRLRP2V5XANCNFSM4JYBYP4Q&data=02%7C01%7Caad.vanes%40vanoord.com%7Cccd6c2facab2476f6c0408d7f023edd7%7Cd62ada1bca424fe2b9e7ceb843af0ad2%7C0%7C1%7C637241909418541399&sdata=mrcMKvnaKTj2jUoY4Fp1WV9RcyEtxwsLhKQT33D52xU%3D&reserved=0.

Disclaimer: This mail transmission and any attached files are confidential and are intended for the addressee only. If you are not the person or organization to whom it is addressed, you must not copy, disclose, distribute or take any action in reliance upon it. If you have received this message in error, please contact the sender by email and delete all copies of this message and all copies of any attached files.

aadvanes commented 4 years ago

If I copy again the upymysql directory to the ESP8266 (don’t know if this is needed), but the upymysql-error is gone.

Another error occurs after calling upymysql.Connect:

%Run -c $EDITOR_CONTENT Warning: lwip.setsockopt() not implemented

Met vriendelijke groet, with kind regards, mit freundlichen Grüßen,

Aad van Es

From: Es A. van (Aad) Sent: woensdag 6 mei 2020 19:10 To: dvrhax/uPyMySQL reply@reply.github.com; dvrhax/uPyMySQL uPyMySQL@noreply.github.com Cc: Comment comment@noreply.github.com Subject: RE: [dvrhax/uPyMySQL] cannot import name Connection (#1)

Hello dvrahx

I compiled upymysql into the esp8266 port. Tnx for the link. Never done before. Tried to exclude ‘btree’, which did not work out well, but it looks like enough memory is available. Now running the original script:

import upymysql.cursors mariadb_connection = upymysql.Connect(host='192.168.0.112', user='aad', password='aad', db='test01', charset='utf8mb4', cursorclass=upymysql.cursors.DictCursor)

Gives the follow error. I don’t know what is wrong.

%Run -c $EDITOR_CONTENT [Errno 103] ECONNABORTED Traceback (most recent call last): File "", line 11, in File "upymysql/init.py", line 89, in Connect File "upymysql/connections.py", line 665, in init File "upymysql/connections.py", line 884, in connect AttributeError: 'module' object has no attribute 'EINTR'

Btw: these modules are now part of the firmware:

MicroPython v1.12-433-g25434e976-dirty on 2020-05-06; ESP module with ESP8266

Type "help()" for more information.

help('modules') main neopixel uheapq upymysql/optionfile _boot network uio upymysql/times _onewire ntptime ujson upymysql/util _uasyncio onewire uos urandom _webrepl port_diag upip ure apa102 sys upip_utarfile uselect btree uarray upymysql/init usocket builtins uasyncio/init upymysql/_socketio ussl dht uasyncio/core upymysql/charset ustruct ds18x20 uasyncio/event upymysql/connections utime esp uasyncio/funcs upymysql/constants/CLIENT utimeq flashbdev uasyncio/lock upymysql/constants/COMMAND uwebsocket framebuf uasyncio/stream upymysql/constants/CR uzlib gc ubinascii upymysql/constants/FIELD_TYPE webrepl inisetup ucollections upymysql/constants/FLAG webrepl_setup lwip ucryptolib upymysql/constants/SERVER_STATUS websocket_helper machine uctypes upymysql/constants/init math uerrno upymysql/converters micropython uhashlib upymysql/cursors Plus any modules on the filesystem

Met vriendelijke groet, with kind regards, mit freundlichen Grüßen,

Aad van Es

From: dvrhax notifications@github.com<mailto:notifications@github.com> Sent: maandag 4 mei 2020 14:09 To: dvrhax/uPyMySQL uPyMySQL@noreply.github.com<mailto:uPyMySQL@noreply.github.com> Cc: Es A. van (Aad) aad.vanes@vanoord.com<mailto:aad.vanes@vanoord.com>; Comment comment@noreply.github.com<mailto:comment@noreply.github.com> Subject: Re: [dvrhax/uPyMySQL] cannot import name Connection (#1)

@sasilva1998https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsasilva1998&data=02%7C01%7Caad.vanes%40vanoord.com%7Cccd6c2facab2476f6c0408d7f023edd7%7Cd62ada1bca424fe2b9e7ceb843af0ad2%7C0%7C1%7C637241909418521408&sdata=PtQXpqo0gLyv%2BlkaeN9ImGHQMTiUYN%2Bv4QhFwGcf8no%3D&reserved=0 You may need to disable B-Tree in the build for the 8266. You can refer to here if you have any questions: https://forum.micropython.org/viewtopic.php?f=3&t=6007https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fforum.micropython.org%2Fviewtopic.php%3Ff%3D3%26t%3D6007&data=02%7C01%7Caad.vanes%40vanoord.com%7Cccd6c2facab2476f6c0408d7f023edd7%7Cd62ada1bca424fe2b9e7ceb843af0ad2%7C0%7C1%7C637241909418531404&sdata=Z3ljCruySLAo8t0hTkReE9iXZpjIl3b6xNLOz57u7Ks%3D&reserved=0

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdvrhax%2FuPyMySQL%2Fissues%2F1%23issuecomment-623425422&data=02%7C01%7Caad.vanes%40vanoord.com%7Cccd6c2facab2476f6c0408d7f023edd7%7Cd62ada1bca424fe2b9e7ceb843af0ad2%7C0%7C1%7C637241909418531404&sdata=y7zce4wB7aINWETIbAYDvhuiNcoHKX6eY%2FSeuLaYVuE%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAINIY4UGADE4POTVH7PMIRLRP2V5XANCNFSM4JYBYP4Q&data=02%7C01%7Caad.vanes%40vanoord.com%7Cccd6c2facab2476f6c0408d7f023edd7%7Cd62ada1bca424fe2b9e7ceb843af0ad2%7C0%7C1%7C637241909418541399&sdata=mrcMKvnaKTj2jUoY4Fp1WV9RcyEtxwsLhKQT33D52xU%3D&reserved=0.

Disclaimer: This mail transmission and any attached files are confidential and are intended for the addressee only. If you are not the person or organization to whom it is addressed, you must not copy, disclose, distribute or take any action in reliance upon it. If you have received this message in error, please contact the sender by email and delete all copies of this message and all copies of any attached files.

dvrhax commented 4 years ago

So that looks like an issue with micropython. That they've removed the EINTR code from uerrno. I've patched a workaround for that but you have an underlying problem. The first line shows a connection aborted error. You probably need to go through and double check all your parameters to make sure they're right. If you don't find anything there I would install https://pypi.org/project/PyMySQL/ and run from a full blown python shell. If it works we may have to trace into the code to see if we can figure out what's wrong. If it doesn't work it will likely give you a more verbose output to help track down the issue with your setup.

cortenlabs commented 1 year ago

Hello dvrhax,

I'm very interested in inserting records into a mysql-database directly from an ESP. (Now using an ESP32-C3) I can hardly believe that there seems to be so little interest in this subject. At least this seems to be the only place in the world where a serious attempt has been made to write directly into a database from a controller with Micropython, for which I thank you very much!. I am in the process of getting this up and running on an ESP32-C3. I was able to successfully co-compile the code with Micropython (which is necessary otherwise there will be memory problems). But the problem now is that the application can't get into contact with the mariadb server. This actually makes sense because I can't find anywhere how the controller connects to a WiFi network which is of course necessary. I can't find a location where Wifi-credentials are stored, or how a connection with an existing wifi connection is being made. I'm probably too much of a novice to understand what to do and maybe this is all very obvious, but at this point I have no idea how this should be done. Hopefully you would like to help me on how to link the wifi connection to your application. Thanks in advance, Paul

BryanSouza91 commented 1 year ago

Hello dvrhax,

I'm very interested in inserting records into a mysql-database directly from an ESP. (Now using an ESP32-C3) I can hardly believe that there seems to be so little interest in this subject. At least this seems to be the only place in the world where a serious attempt has been made to write directly into a database from a controller with Micropython, for which I thank you very much!. I am in the process of getting this up and running on an ESP32-C3. I was able to successfully co-compile the code with Micropython (which is necessary otherwise there will be memory problems). But the problem now is that the application can't get into contact with the mariadb server. This actually makes sense because I can't find anywhere how the controller connects to a WiFi network which is of course necessary. I can't find a location where Wifi-credentials are stored, or how a connection with an existing wifi connection is being made. I'm probably too much of a novice to understand what to do and maybe this is all very obvious, but at this point I have no idea how this should be done. Hopefully you would like to help me on how to link the wifi connection to your application. Thanks in advance, Paul

Hey Paul @cortenlabs,

I used the do_connect function(link below) in the boot file for the device so that it was connected to the network on boot. Hope that helps. Good luck.

Micropython ESP32 Networking Documentation

Bryan

cortenlabs commented 1 year ago

Hello Bryan,

Thank you very much for your reply. You helped me very well and pointed me in the right direction by telling me what is not the problem. As I already had tried something like in the link you provided, I was thinking the application could not link to the already made wifi connection. But that was not the problem! As expected I did something stupid. Starting with the default installation of mariadb I got version 10 and therefore port 3307. So I put in as hostname "192.168.0.101:3307". I know: windows thinking. The port has (of course) to be defined separately. Therefore for other novices like me, the connection phrase with port:


connection = upymysql.connect(host='localhost',
                             port = 3307,
                             user='user',
                             password='passwd',
                             db='db',
                             charset='utf8mb4',
                             cursorclass=upymysql.cursors.DictCursor)

Now it's working

BryanSouza91 commented 3 weeks ago

So that looks like an issue with micropython. That they've removed the EINTR code from uerrno. I've patched a workaround for that but you have an underlying problem. The first line shows a connection aborted error. You probably need to go through and double check all your parameters to make sure they're right. If you don't find anything there I would install https://pypi.org/project/PyMySQL/ and run from a full blown python shell. If it works we may have to trace into the code to see if we can figure out what's wrong. If it doesn't work it will likely give you a more verbose output to help track down the issue with your setup.

Back from the dead with this project...

I am getting the same error and I verified the code with PyMySQL in a python shell so I believe something is amiss. Let me know how to help figure this out if you don't have the time. I still feel that this is a great option for IoT data collection, etc.

BryanSouza91 commented 3 weeks ago

According to micropython issue #3327, it should be as easy as adding the micropython-lib/python-stdlib/errno/errno.py to the modules folder of the port we are using i.e. ports/esp8266.

I will give this a try and report back.

BryanSouza91 commented 3 weeks ago

Adding errno.py file to modules does fix the EINTR error however I am getting another error. I think this issue can be closed, as the new error is a different problem, I will open another issue for that. Hope this helps someone in the future.