Hello everyone…
I have made a code in python2.7 in which i need a serial module to access COM ports for serial communication.
I have tried the same code in my windows and linux pc(Ubuntu) and its running fine there but in case of running on my toradex board it is giving me an error…
AttributeError: ‘module’ object has no attribute ‘Serial’…
I have installed both modules serial and pyserial which are required for it but still it is giving me this error…please suggest me what should i do for it?
Hi @akshat
I have installed both modules serial and pyserial which are required for it but still it is giving me this error.
How did you install the these modules?
Could you provide a sample code in a text file, so we can check this?
Thanks and best regards,
Jaski
please reply…to the above attached text file
Hi @akshat
I have installed the Bsp version 4.9.166-2.8.6+gd899927728be
on Apalis iMX6. Then I did the following to install the needed modules:
- opkg update
- opkg install python
- opkg install pyhton-pip
- pip install serial
- pip install pyserial
In Python, I used the following code,
>>> import serial
>>> ser=serial.Serial('/dev/ttymxc4')
>>> print ser.name
/dev/ttymxc4
which is working perfectly.
Best regards,
Jaski
hello @jaski.tx
please tell me the way how you install python and what is BSP version?
and from where i can get it?
please guide me the steps
Hi @akshat
please tell me the way how you install python and what is BSP version?
Sure, this is marked in the answer above.
and from where i can get it?
Depending on the method, you want to use for Deployment, you can get the Legacy Image here which is installed using Legacy Flashing Method and Toradex Easy Installer Image here, which is installed using Toradex Easy Installer.
please guide me the steps
Sure, just follow the steps written in the links above.
Best regards,
Jaski
i need to install a custom image for this or to install torizon?
can it be done on kernel version itself?
i need to install a custom image for this or to install torizon?
The instructions I gave you are are for the mentioned image. If you want to install torizon and then use a container of your choice, this depends on you.
can it be done on kernel version itself?
What can be done on kernel version? I don’t understand the question.
i dont want to install torizon and neither want to make custom image…is there chance without these things i can run my python 2.7 fine with no errors…like above i am not able to download the modules i want…(ex:serial)
You don’t have to do anything. Just install this image, then you will be able to install the modules.
Best regards,
Jaski