1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Install pyserial error

Discussion in 'Tomato Firmware' started by jbcdidgosir, Sep 11, 2013.

  1. jbcdidgosir

    jbcdidgosir Serious Server Member

    I want to install pyserial on python based on tomato. But when I run python setup.py, it displayed:
    Traceback (most recent call last):
    File "setup.py", line 14, in <module>
    from distutils.core import setup
    ImportError: No module named distutils.core

    So how can I install this module? Or is there a "green" way to install this module? I mean, someone install it and then copy the installed programs to me. I copy it to my python and use it. Is it possible?

    I just want to send AT command to control the 3G network card. So is there any other way to do it? I must do the program in python.

    Thanks!
     
  2. lancethepants

    lancethepants Network Guru Member

    You don't mention if you're running optware, or entware.
    I compiled this with my own homebrew project called tomatoware.
    No idea if this will work with your current setup, but here's is what it created, called 'miniterm.py'.
    You can find this at lancethepants.com/files under Tomatoware.

    I think it mostly will depend on the line
    Code:
    import sys, os, serial, threading
    
    If you already have those modules.

    I am using python2.7. I've included the miniterm.py binary, and all the libs. Don't know if it will be binary compatible with your setup.
     
    Last edited: Sep 11, 2013
  3. jbcdidgosir

    jbcdidgosir Serious Server Member


    My python is 2.6

    My purpose is just to send command on ttyUSB0 by phthon. I don't care any means, any way to do it.

    Now the current question is: can pyserial open and control ttyUSB0? I found that it seems can only control the port name by "COM"+X, such as COM1, COM2...

    No matter I can use or not, can you send the program to me? I need to import serial, regex, MsTimer. Can you find these files?
     
    Last edited: Sep 11, 2013
  4. lancethepants

    lancethepants Network Guru Member

    The easiest way I can think of, provided this is not in optware or entware, is to then wipe out /opt completely, and install my Toamtoware. Simply extract it in /opt.
    Then make sure to log off ssh and relogin.

    From there you can download the py_serial source.

    Run
    Code:
    python ./setup.py build
    python ./setyp.py install
    
    From prior experiences, I think you'll also want to run
    Code:
    modprobe pl2303
    
    This loads the serial driver, to allow communication to serial devices attached through USB.

    As far as how py_serial operates, I cannot say. I have no way to test it, you'll have to test it yourself.
     
  5. lancethepants

    lancethepants Network Guru Member

  6. jbcdidgosir

    jbcdidgosir Serious Server Member


    My python is not a full function version. It was simply and size reduced to only 7M. That’s the season why after I run python setup.py, it displayed:
    Traceback (most recent call last):
    File "setup.py", line 14, in <module>
    from distutils.core import setup
    ImportError: No module named distutils.core
     

Share This Page