Sublime Forum

Import serial not found

#1

I have just installed Sublime and tried to run an existing working program which runs without error in Python3.

The following simple program extract generates errors when built through sublime.

import serial
from tkinter import *

This gives the error “no module named serial”. Yet I am certain that serial has been installed in Python.
i have searched previous messages related to this error but the solution suggested if installing serial does not apply to me for the above reason.

Any help will be appreciated.

0 Likes

#2

the built in build system executes python by default, which is likely python 2 on your system. You may need to tweak it to execute python3 instead

0 Likes

#3

Thank you for your fast response. I was using the option Tools > Build System > Automatic on the file named test.py.
When I changed to Tools > Build System > Python that error disappeared but program did not actually run ( N.B. I had added the line print(“hello”) to my 2 line program to see some action).

Following another suggestion to resolve the latter I did also Tools > Build with > Python and the original problem came back.

I am obviously missing something out. How do I ensure that Sublime invokes Python3 not any other version?

0 Likes

#4
0 Likes

#5

Hi.

Using the method outlined in this link:

I found that Sublime was calling version 2.7 for me. I fixed the problem by creating a New Build System as outlined in the same link.

Nonetheless I thank you for your advice.

0 Likes