Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: must be string, not int #58

Closed
ghost opened this issue Mar 14, 2015 · 5 comments
Closed

TypeError: must be string, not int #58

ghost opened this issue Mar 14, 2015 · 5 comments
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Mar 14, 2015

In a freshly installed Debian (2015-03-01) on Beaglebone Black Rev A6A, the encoder_test.py example shows this error:

Traceback (most recent call last):
  File "encoder_test.py", line 24, in <module>
    run(setup, loop)
  File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.9.3-py2.7-linux-armv7l.egg/bbio/bbio.py", line 60, in run
    loop()
  File "encoder_test.py", line 22, in loop
    delay(1000)
  File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.9.3-py2.7-linux-armv7l.egg/bbio/common.py", line 36, in delay
    time.sleep(ms/1000.0)
TypeError: must be string, not int
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.9.3-py2.7-linux-armv7l.egg/bbio/bbio.py", line 21, in bbio_cleanup
    for cleanup in ADDITIONAL_CLEANUP:
TypeError: must be string, not int
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.9.3-py2.7-linux-armv7l.egg/bbio/bbio.py", line 21, in bbio_cleanup
    for cleanup in ADDITIONAL_CLEANUP:
TypeError: must be string, not int
@sahmad98
Copy link

Code is wrong at time.sleep(ms/1000), is ms previously defined. Check for
that because sleep function takes int.

On Saturday, March 14, 2015, Ali Yousuf notifications@github.com wrote:

In a freshly installed Debian (2015-03-01) on Beaglebone Black Rev A6A,
the encoder_test.py example shows this error:

Traceback (most recent call last):
File "encoder_test.py", line 24, in
run(setup, loop)
File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.9.3-py2.7-linux-armv7l.egg/bbio/bbio.py", line 60, in run
loop()
File "encoder_test.py", line 22, in loop
delay(1000)
File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.9.3-py2.7-linux-armv7l.egg/bbio/common.py", line 36, in delay
time.sleep(ms/1000.0)
TypeError: must be string, not int
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(_targs, *_kargs)
File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.9.3-py2.7-linux-armv7l.egg/bbio/bbio.py", line 21, in bbio_cleanup
for cleanup in ADDITIONAL_CLEANUP:
TypeError: must be string, not int
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(_targs, *_kargs)
File "/usr/local/lib/python2.7/dist-packages/PyBBIO-0.9.3-py2.7-linux-armv7l.egg/bbio/bbio.py", line 21, in bbio_cleanup
for cleanup in ADDITIONAL_CLEANUP:
TypeError: must be string, not int

Reply to this email directly or view it on GitHub
#58.

Saleem Ahmad

@ghost
Copy link
Author

ghost commented Mar 14, 2015

I have not changed anything in the example. It is in integer already. The error says "must be String" -- I'm also confused at this.
Here is the code

#!/usr/bin/env python
"""
 encoder_test.py
 Rekha Seethamraju

 An example to demonstrate the use of the eQEP library
 for PyBBIO.

 This example program is in the public domain.
"""
from bbio import *
from bbio.libraries.RotaryEncoder import RotaryEncoder

encoder = RotaryEncoder(RotaryEncoder.EQEP2b)

def setup():
  encoder.setAbsolute()
  encoder.zero()

def loop():
  print "encoder position : \t"+encoder.getPosition()
  delay(1000)

run(setup, loop)

@alexanderhiam
Copy link
Member

Hmm... this is an odd one. Seems that either the RotaryEncoder library itself or the sysfs C extension it uses to read/write the eQEP driver files is the source of the problem (time.sleep most certainly doesn't take a string!). I'm looking into it...

@KirkAtWork
Copy link

Just letting you know I'm having the exact same problem with the same code
I'm on Beaglebone Black Rev C. Version is:
Linux beaglebone 3.8.13-bone70 #1 SMP Fri Jan 23 02:15:42 UTC 2015 armv7l GNU/Linux

Any new ideas on this yet? I'm stuck

@alexanderhiam
Copy link
Member

OK got it, I was missing a type check in a C extension, and the TypeError was popping up at a weird time.

@alexanderhiam alexanderhiam added this to the v0.9.4 milestone Apr 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants