I am trying to use the serial port on the Raspberry but when I run the example below I have the message:

TypeError: 'module' object is not callable

import time
import serial

ser = serial.serial(
        baudrate = 9600,

while 1:
        print (x)
  • Hi @Wagner Ideali, Welcome. Ah let me see. Your edited program does not seem to match the earlier error message, therefore should mislead future readers. Anyway, I tried tracin back the original picture and reproduce your situation, but failed: imgur.com/gallery/1Rh4vVk. – tlfong01 Nov 28 '19 at 3:13
  • Your original version seems to have a syntax/typo error of "serial.serial(...)" which should read "serial.Serial(...)". So I tried to run your version 1 and got the same error as yours. So far so good. Now your version 2 have a new error. I guess it is the serial/.write and serial readline error. Anyway I have summarized version 1 and version 2 results in the following penzu link:penzu.com/p/350d51c9. If you can confirm I have understood your question correctly, then I would move on to compile my answer. Cheers.. – tlfong01 Nov 28 '19 at 3:36
  • I removed the pyserial and re install it and running ok now – Wagner Ideali Dec 1 '19 at 4:50
  • Thank you for your update. How nice to hear that problem solved. Cheers. – tlfong01 Dec 1 '19 at 5:13
  • Hi tlfong01, I didnt understand very weel your comment above and so, I formatted the SD card, installed again the raspbian and re installed the pyserial and now is ok, but new problem is happen with pynput module and I put this problem in another question – Wagner Ideali Dec 1 '19 at 10:02

Linux and Python are case sensitive.

Try ser = serial.Serial(

  • Could you edit your question and cut&paste the full traceback? – joan Nov 27 '19 at 14:55
  • 1
    @WagnerIdeali You should edit your question to add information, not add a comment. – joan Nov 27 '19 at 17:38
  • 1
    @WagnerIdeali There is a link below your question named edit. Please click on it and add additional information to the question. – Ingo Nov 27 '19 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.