WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: pyserial in Python 3.6  (Read 2575 times)

Offline RAWeigel

  • Newbie
  • *
  • Posts: 5
pyserial in Python 3.6
« on: February 23, 2019, 03:34:36 AM »
Hi,
how do I run the SERIAL module in PYTHON 3.6?
In version 2.6, it's OK, but I'd like to use version 3.6 of PYTHON.
/Richard

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: pyserial in Python 3.6
« Reply #1 on: February 23, 2019, 06:45:56 AM »
Hi RAWeigel
Your question sounds a little vague. What did you do in version 2.6 that worked? What error are you getting in version 3.6?
If you provide some information, someone may be able to help you.

Offline RAWeigel

  • Newbie
  • *
  • Posts: 5
Re: pyserial in Python 3.6
« Reply #2 on: February 23, 2019, 09:33:44 AM »
Thanks for replying, Rich.

Sorry for the lack of details and simple questions, but I'm learning to use Linux.
For version 2.6, I installed pyserial and did a simple test in IDLE:
Code: [Select]
Python 2.7.14 (default, Mar 22 2018, 15:55:05)
[GCC 7.2.0] on linux2
Type "copyright", "credits" or "license()" for more information.
>>> from serial import*
>>>

Doing the same thing in the IDLE3 version:
Code: [Select]
Python 3.6.4 (default, Mar  9 2018, 13:17:33)
[GCC 7.2.0] on linux
Type "copyright", "credits" or "license()" for more information.
>>> from serial import*
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    from serial import*
ModuleNotFoundError: No module named 'serial'
>>>

My English is poor, so I got help from the Google translator.  :-[
/Richard

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: pyserial in Python 3.6
« Reply #3 on: February 23, 2019, 10:01:47 AM »
Hi RAWeigel
I suspect you'll find there are 2 problems. The  pyserial  extension uses:
Code: [Select]
/usr/local/lib/python2.7/site-packages/while python3.6 uses:
Code: [Select]
/usr/local/lib/python3.6/site-packages/The second possible problem is whether  pyserial  files are even compatible with  python3.6.

Offline RAWeigel

  • Newbie
  • *
  • Posts: 5
Re: pyserial in Python 3.6
« Reply #4 on: February 23, 2019, 10:50:58 AM »
Yes, pyserial runs in Windows + Python 3.x
Code: [Select]
Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> from serial import*
>>>

I copy:
Code: [Select]
/usr/local/lib/python2.7/site-packages/serialTo:
Code: [Select]
/usr/local/lib/python3.6/site-packages/serial, but another error occurs:

Code: [Select]
Python 3.6.4 (default, Mar  9 2018, 13:17:33)
[GCC 7.2.0] on linux
Type "copyright", "credits" or "license()" for more information.
>>> from serial import*
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    from serial import*
  File "/usr/local/lib/python3.6/site-packages/serial/__init__.py", line 21, in <module>
    from serialposix import *
ModuleNotFoundError: No module named 'serialposix'
>>>

Yes, "serialposix" file exists at this location.

/Richard
/Richard

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: pyserial in Python 3.6
« Reply #5 on: February 23, 2019, 10:57:55 AM »
Hi RAWeigel
Which brings us to this:
The second possible problem is whether  pyserial  files are even compatible with  python3.6.
It's possible the  /usr/local/lib/python2.7/site-packages/  path is hardcoded into the pyserial files.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: pyserial in Python 3.6
« Reply #6 on: February 23, 2019, 11:10:58 AM »
Hi RAWeigel
You may need to download a newer version of  pyserial   from their website. I don't work in python myself but I believe I've
seen other members mention using a  pip  command to install other python programs. Try the search page:
http://forum.tinycorelinux.net/index.php?action=search
Set  Search order:  to  Most recent topics first  and enter  python pip -pipe  in the  Search for:  field to see if there are any
useful hints on installations.

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: pyserial in Python 3.6
« Reply #7 on: February 23, 2019, 10:42:11 PM »
py3.6serial posted, pyserial updated

Note that python extensions are specific to the major/minor versions of python that they were compiled for:

* pyserial, compiled on python-2.7.x will not work on python-2.6.x nor python3.x
* py3.6serial compiled on python-3.6.x will not work on python-3.5.x nor python2.x

Offline RAWeigel

  • Newbie
  • *
  • Posts: 5
Re: pyserial in Python 3.6
« Reply #8 on: February 24, 2019, 02:31:24 AM »
py3.6serial posted, pyserial updated

Note that python extensions are specific to the major/minor versions of python that they were compiled for:

* pyserial, compiled on python-2.7.x will not work on python-2.6.x nor python3.x
* py3.6serial compiled on python-3.6.x will not work on python-3.5.x nor python2.x
Hi Juanito,

 :) Thanks for the new update, but ... I still can not find this file.
I looked for several mirros.
Is there any specific mirror?

/Richard
/Richard

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: pyserial in Python 3.6
« Reply #9 on: February 24, 2019, 02:39:29 AM »
It might take up to a day for the mirrors to update - the main repo is repo.tinycorelinux.net

Offline RAWeigel

  • Newbie
  • *
  • Posts: 5
Re: pyserial in Python 3.6
« Reply #10 on: February 24, 2019, 03:04:14 AM »
It might take up to a day for the mirrors to update - the main repo is repo.tinycorelinux.net

I found!  8)
Installed, but ... it only run after copied the directory SERIAL:
Code: [Select]
/usr/local/lib/python3.6/site-packages/pyserial-3.2.1-py3.6.egg/serial
For:
Code: [Select]
/usr/local/lib/python3.6/site-packages/serial
Thanks @Juanito and @Rich

/Richard
/Richard

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: pyserial in Python 3.6
« Reply #11 on: February 24, 2019, 04:14:40 AM »
adjusted py3.6serial posted