Announcement

Collapse
No announcement yet.

Problem with Python library [libsmartpen]

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Problem with Python library [libsmartpen]

    I am trying to recognize a (livescribe) smartpen on linux.

    A guy developed a library (https://github.com/srwalter/libsmartpen) and a browser (https://github.com/srwalter/smartpen-browser) to access its file. I installed both using his PPA, but when I run the browser, i got the message:

    Code:
    Traceback (most recent call last):
    File "/usr/bin/smartpen-browser.py", line 4, in
    import pysmartpen
    ImportError: No module named pysmartpen
    He asked my to run the commands dpkg -L libsmartpen and ldd /usr/lib/pyshared/python2.7/pysmartpen.so and got:

    Code:
    /.
    /usr
    /usr/share
    /usr/share/python-support
    /usr/share/python-support/libsmartpen.public
    /usr/share/doc
    /usr/share/doc/libsmartpen
    /usr/share/doc/libsmartpen/copyright
    /usr/share/doc/libsmartpen/changelog.Debian.gz
    /usr/share/pyshared
    /usr/share/pyshared/pysmartpen-0.0.0.egg-info
    /usr/share/pyshared/parsestf.py
    /usr/lib
    /usr/lib/libsmartpen.so
    /usr/lib/pyshared
    /usr/lib/pyshared/python2.7
    /usr/lib/pyshared/python2.7/pysmartpen.so
    /lib
    /lib/udev
    /lib/udev/rules.d
    /lib/udev/rules.d/75-smartpen.rules
    And:

    Code:
        linux-vdso.so.1 =>  (0x00007fffbfb8a000)                                                                                                                            
        libsmartpen.so => /usr/lib/libsmartpen.so (0x00007f61fa283000)                                                                                                                           
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f61fa065000)                                                                                                                           
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f61f9c9b000)                                                                                                                           
        libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f61f998c000)                                                                                                                           
        libopenobex.so.1 => /usr/lib/libopenobex.so.1 (0x00007f61f9782000)                                                                                                                           
        libusb-1.0.so.0 => /lib/x86_64-linux-gnu/libusb-1.0.so.0 (0x00007f61f956a000)                                                                                                                           
        /lib64/ld-linux-x86-64.so.2 (0x00007f61fa68c000)                                                                                                                           
        libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f61f92fd000)                                                                                                                            
        libusb-0.1.so.4 => /lib/x86_64-linux-gnu/libusb-0.1.so.4 (0x00007f61f90f4000)                                                                                                                            
        libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007f61f8ee1000)
    The author has no idea of what is happening. But I got the same behaviour in tw different pcs runing kubuntu 15.04.

    Any ideas?
    Kubuntu 15.10 - Asus All-in-one (i3, 4GB ram)

    #2
    What you you get if you run

    Code:
    import sys
    sys.path
    Also from the terminal can you run
    Code:
    locate smartpen.py
    Last edited by elijathegold; Sep 20, 2015, 07:35 AM.
    If you're sitting wondering,
    Which Batman is the best,
    There's only one true answer my friend,
    It's Adam Bloody West!

    Comment


      #3
      I've just found the guy's ppa and it looks like it only supports up to 14.04 which may be causing the issue, I don't know if files paths or versions have changed from 14.04 to 15.04. Another option may be to un-install from the ppa and grab the zip file from the github page and run
      Code:
      sudo python setup.py
      from within the extracted directory.

      *** DO NOT DO THIS. IT GETS COMPLICATED QUICKLY ***
      Last edited by elijathegold; Sep 20, 2015, 09:27 AM.
      If you're sitting wondering,
      Which Batman is the best,
      There's only one true answer my friend,
      It's Adam Bloody West!

      Comment


        #4
        OK got it working!

        This involves editing the file /usr/bin/smartpen-browser.py so you may want to back it up first.

        Open a terminal and run the command
        Code:
        sudo nano /usr/bin/smartpen-browser.py
        and give your password when asked.

        Edit the first lines of code to add the highlighted lines

        Code:
        #!/usr/bin/python
        
        [COLOR=#ff0000]import sys
        sys.path.append("/usr/lib/pyshared/python2.7")
        sys.path.append("/usr/share/pyshared/")[/COLOR]
        import gtk
        import pysmartpen
        Save the file by pressing Ctrl + O and then enter and exit nano using Ctrl + X. It should now run but I don't have a light pen so can't really test things.

        [edit]

        I wasn't entirely happy with the solution above. Adding the following line to your ~/.bashrc is a far more elegant solution.

        Code:
        export PYTHONPATH=/usr/lib/pyshared//python2.7/:/usr/share/pyshared/:PYTHONPATH
        and then run
        Code:
        source .bashrc
        to reload the file.


        [/edit]
        Last edited by elijathegold; Sep 20, 2015, 11:29 AM.
        If you're sitting wondering,
        Which Batman is the best,
        There's only one true answer my friend,
        It's Adam Bloody West!

        Comment


          #5
          It worked for me!
          Thank you, man.
          Kubuntu 15.10 - Asus All-in-one (i3, 4GB ram)

          Comment

          Working...
          X