Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Dec 2016
    Posts
    23

    Add a python library (SPI-pi) to picoreplayer

    H there,

    i want to use an RFID Reader combined with picoreplayer.
    For that rfid reader, i need to use a library (MRFC522 library) and the library needs SPI-py https://github.com/lthiery/SPI-Py.
    i have installed python-dev, compile?? and RPI-Gpio?? extensions (via the webpage)

    So now i just downloaded the SPI-py library on my Windows pc and then copied the folder to home/tc/SPI-Py.

    Now i need to install it, and thats my problem:

    When i use:
    Code:
    sudo python setup.py install
    it installs fine, but i can only use it until the next reboot, because the internal backup function of picoreplayer does not backup the installation folder of SPI-py (not that one under /home/tc, but the one where it gets installed)

    If i use
    Code:
    sudo python setup.py install --user
    i can start my python script which uses it also after restarting picoreplayer (and using its backup function) but i cannot autostart my script, it only works if i start the script inside its installation folder (i mean it starts only if i do: Cd /home/tc/Myscript/ and then sudo python Myscript.py
    .

    Autostarting is done by using:

    sudo nano /opt/bootlocal.sh
    sudo python /home/tc/Myscript/Myscript.py

    Any idea how to solve this?

    Like Backup the Library differently? or installing it differently?

    Greetings

    cubii
    Last edited by cubii; 2017-03-18 at 02:07.

  2. #2
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    640
    Quote Originally Posted by cubii View Post
    H there,

    i want to use an RFID Reader combined with picoreplayer.
    For that rfid reader, i need to use a library (MRFC522 library) and the library needs SPI-py https://github.com/lthiery/SPI-Py.
    i have installed python-dev, compile?? and RPI-Gpio?? extensions (via the webpage)

    So now i just downloaded the SPI-py library on my Windows pc and then copied the folder to home/tc/SPI-Py.

    Now i need to install it, and thats my problem:

    When i use:
    Code:
    sudo python setup.py install
    it installs fine, but i can only use it until the next reboot, because the internal backup function of picoreplayer does not backup the installation folder of SPI-py (not that one under /home/tc, but the one where it gets installed)

    If i use
    Code:
    sudo python setup.py install --user
    i can start my python script which uses it also after restarting picoreplayer (and using its backup function) but i cannot autostart my script, it only works if i start the script inside its installation folder (i mean it starts only if i do: Cd /home/tc/Myscript/ and then sudo python Myscript.py
    .

    Autostarting is done by using:

    sudo nano /opt/bootlocal.sh
    sudo python /home/tc/Myscript/Myscript.py

    Any idea how to solve this?

    Like Backup the Library differently? or installing it differently?

    Greetings

    cubii
    That's starting to get involved, have you read all of the information over at www.tinycorelinux.net? There is a lot of information about persistence and creating extensions for the Core based OS.

    Files are Backed up based on /opt/.filetool.lst

  3. #3
    Junior Member
    Join Date
    Dec 2016
    Posts
    23
    Quote Originally Posted by paul- View Post
    Files are Backed up based on /opt/.filetool.lst
    Thanks for the answer, i have added the folder usr/local/lib/python2.7/site-packages to /opt/.filetool.list

    so that the compiled SPI-py module gets backed up.

    Now the startup of myscript.py works.

    Is this good way to do it? or at least ok?


    Greetings

    cubii

  4. #4
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    640
    Quote Originally Posted by cubii View Post
    Thanks for the answer, i have added the folder usr/local/lib/python2.7/site-packages to /opt/.filetool.list

    so that the compiled SPI-py module gets backed up.

    Now the startup of myscript.py works.

    Is this good way to do it? or at least ok?


    Greetings

    cubii
    Backups work fine, we do it more than we should with pCP. If files never change, they are better off in extensions.

  5. #5
    Junior Member
    Join Date
    Dec 2016
    Posts
    23
    Thanks,

    If i have the time, i will read into the extension thing of tinycorelinux.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •