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

Python - module 'time' has no attribute 'clock' #12

Open
MatejBosansky opened this issue Nov 26, 2022 · 5 comments
Open

Python - module 'time' has no attribute 'clock' #12

MatejBosansky opened this issue Nov 26, 2022 · 5 comments

Comments

@MatejBosansky
Copy link

I tired to run Python examples but for all of them I received error

12.48inch e-paper B Demo...
EPD init...
set wiringPi lib success !!!
clearing...
Traceback (most recent call last):
  File "/home/pi/eink2/12.48inch_e-Paper_Module_Code/python/examples/epd_12in48B_test.py", line 29, in <module>
    epd.clear()
  File "/home/pi/eink2/12.48inch_e-Paper_Module_Code/python/lib/epd12in48b.py", line 231, in clear
    start = time.clock()
AttributeError: module 'time' has no attribute 'clock'

Looks like your epd12in48b.py driver is not compatible with latest python. Based on replies in
https://stackoverflow.com/questions/58569361/attributeerror-module-time-has-no-attribute-clock-in-python-3-8
time.clock() was removed in 3.8 Python version

@SSYYL
Copy link
Collaborator

SSYYL commented Nov 28, 2022

@MatejBosansky
time.perf_counter() has been used to replace it, please try it, thanks :)

@MatejBosansky
Copy link
Author

@SSYYL I pulled updated library into new folder. Now I received different error.

Traceback (most recent call last):
  File "/home/pi/eink3/12.48inch_e-Paper_Module_Code/python/examples/epd_12in48B_V2_test.py", line 11, in <module>
    import epd12in48b_V2
  File "/home/pi/eink3/12.48inch_e-Paper_Module_Code/python/lib/epd12in48b_V2.py", line 30, in <module>
    import epdconfig
  File "/home/pi/eink3/12.48inch_e-Paper_Module_Code/python/lib/epdconfig.py", line 65, in <module>
    spi = CDLL(so_filename)
  File "/usr/lib/python3.9/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /home/pi/eink3/12.48inch_e-Paper_Module_Code/python/lib/DEV_Config.so: wrong ELF class: ELFCLASS64

@SSYYL
Copy link
Collaborator

SSYYL commented Nov 28, 2022

@MatejBosansky , Have you installed bcm2835? If not, please install it:

wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz 
tar zxvf bcm2835-1.71.tar.gz
cd bcm2835-1.71/ 
sudo ./configure && sudo make && sudo make check && sudo make install

@MatejBosansky
Copy link
Author

@SSYYL I had on this Raspi machine project with 7.5inch e-ink model where I installed this library and it worked fine. So for 12inch model I skipped this step. However I installed it again according to wiki.

wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz
tar zxvf bcm2835-1.71.tar.gz 
cd bcm2835-1.71/
sudo ./configure && sudo make && sudo make check && sudo make install

But it failed again

pi@raspberrypi:~/eink3/12.48inch_e-Paper_Module_Code/python/examples $ python3 epd_12in48B_V2_test.py
Traceback (most recent call last):
  File "/home/pi/eink3/12.48inch_e-Paper_Module_Code/python/examples/epd_12in48B_V2_test.py", line 11, in <module>
    import epd12in48b_V2
  File "/home/pi/eink3/12.48inch_e-Paper_Module_Code/python/lib/epd12in48b_V2.py", line 30, in <module>
    import epdconfig
  File "/home/pi/eink3/12.48inch_e-Paper_Module_Code/python/lib/epdconfig.py", line 65, in <module>
    spi = CDLL(so_filename)
  File "/usr/lib/python3.9/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /home/pi/eink3/12.48inch_e-Paper_Module_Code/python/lib/DEV_Config.so: wrong ELF class: ELFCLASS64

Just FYI, after my first report in that pull I edited epd12in48b_V2.py to just remove of using time.clock() since it served only for logging and then it worked fine. Looks like changes DEV_Config.so caused this issue.

attaching installation


pi@raspberrypi:~ $ wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz
--2022-11-28 10:30:50--  http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz
Prevádza sa www.airspayce.com (www.airspayce.com) na IP adresu... 192.185.48.187
Pripájanie k www.airspayce.com (www.airspayce.com)|192.185.48.187|:80... pripojené.
HTTP požiadavka odoslaná, čakám na odpoveď... 200 OK
Dĺžka:  276152 (270K) [application/x-gzip]
Ukladá sa do: `bcm2835-1.71.tar.gz'

bcm2835-1.71.tar.gz           100%[=================================================>] 269,68K   539KB/s    za 0,5s

2022-11-28 10:30:51 (539 KB/s) - `bcm2835-1.71.tar.gz' uložené [276152/276152]

pi@raspberrypi:~ $ tar zxvf bcm2835-1.71.tar.gz
bcm2835-1.71/
bcm2835-1.71/configure.ac
bcm2835-1.71/COPYING
bcm2835-1.71/examples/
bcm2835-1.71/examples/spi/
bcm2835-1.71/examples/spi/spi.c
bcm2835-1.71/examples/input/
bcm2835-1.71/examples/input/input.c
bcm2835-1.71/examples/spiram/
bcm2835-1.71/examples/spiram/spiram.h
bcm2835-1.71/examples/spiram/spiram_test.c
bcm2835-1.71/examples/spiram/spiram.c
bcm2835-1.71/examples/event/
bcm2835-1.71/examples/event/event.c
bcm2835-1.71/examples/pwm/
bcm2835-1.71/examples/pwm/pwm.c
bcm2835-1.71/examples/gpio/
bcm2835-1.71/examples/gpio/gpio.c
bcm2835-1.71/examples/blink/
bcm2835-1.71/examples/blink/blink.c
bcm2835-1.71/examples/spin/
bcm2835-1.71/examples/spin/spin.c
bcm2835-1.71/examples/i2c/
bcm2835-1.71/examples/i2c/i2c.c
bcm2835-1.71/config.guess
bcm2835-1.71/NEWS
bcm2835-1.71/depcomp
bcm2835-1.71/configure
bcm2835-1.71/aclocal.m4
bcm2835-1.71/compile
bcm2835-1.71/INSTALL
bcm2835-1.71/Makefile.in
bcm2835-1.71/missing
bcm2835-1.71/config.sub
bcm2835-1.71/Makefile.am
bcm2835-1.71/ChangeLog
bcm2835-1.71/README
bcm2835-1.71/install-sh
bcm2835-1.71/config.h.in
bcm2835-1.71/src/
bcm2835-1.71/src/test.c
bcm2835-1.71/src/bcm2835.h
bcm2835-1.71/src/bcm2835.c
bcm2835-1.71/src/Makefile.in
bcm2835-1.71/src/Makefile.am
bcm2835-1.71/ltmain.sh
bcm2835-1.71/AUTHORS
bcm2835-1.71/doc/
bcm2835-1.71/doc/Doxyfile.in
bcm2835-1.71/doc/Makefile.in
bcm2835-1.71/doc/Makefile.am
bcm2835-1.71/test-driver
pi@raspberrypi:~ $ cd bcm2835-1.71/
pi@raspberrypi:~/bcm2835-1.71 $ sudo ./configure && sudo make && sudo make check && sudo make install
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for clock_gettime in -lrt... yes
checking for doxygen... no
configure: WARNING: Doxygen not found - continuing without Doxygen support
checking for ranlib... ranlib
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating doc/Makefile
config.status: creating config.h
config.status: executing depfiles commands
make  all-recursive
make[1]: Entering directory '/home/pi/bcm2835-1.71'
Making all in src
make[2]: Entering directory '/home/pi/bcm2835-1.71/src'
gcc -DHAVE_CONFIG_H -I. -I..     -g -O2 -MT bcm2835.o -MD -MP -MF .deps/bcm2835.Tpo -c -o bcm2835.o bcm2835.c
mv -f .deps/bcm2835.Tpo .deps/bcm2835.Po
rm -f libbcm2835.a
ar cru libbcm2835.a bcm2835.o
ar: `u' modifier ignored since `D' is the default (see `U')
ranlib libbcm2835.a
make[2]: Leaving directory '/home/pi/bcm2835-1.71/src'
Making all in doc
make[2]: Entering directory '/home/pi/bcm2835-1.71/doc'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/pi/bcm2835-1.71/doc'
make[2]: Entering directory '/home/pi/bcm2835-1.71'
make[2]: Leaving directory '/home/pi/bcm2835-1.71'
make[1]: Leaving directory '/home/pi/bcm2835-1.71'
Making check in src
make[1]: Entering directory '/home/pi/bcm2835-1.71/src'
make  test
make[2]: Entering directory '/home/pi/bcm2835-1.71/src'
gcc -DHAVE_CONFIG_H -I. -I..     -g -O2 -MT test.o -MD -MP -MF .deps/test.Tpo -c -o test.o test.c
mv -f .deps/test.Tpo .deps/test.Po
gcc  -g -O2   -o test test.o ./libbcm2835.a -lrt
make[2]: Leaving directory '/home/pi/bcm2835-1.71/src'
make  check-TESTS
make[2]: Entering directory '/home/pi/bcm2835-1.71/src'
make[3]: Entering directory '/home/pi/bcm2835-1.71/src'
PASS: test
============================================================================
Testsuite summary for bcm2835 1.71
============================================================================
# TOTAL: 1
# PASS:  1
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[3]: Leaving directory '/home/pi/bcm2835-1.71/src'
make[2]: Leaving directory '/home/pi/bcm2835-1.71/src'
make[1]: Leaving directory '/home/pi/bcm2835-1.71/src'
Making check in doc
make[1]: Entering directory '/home/pi/bcm2835-1.71/doc'
make[1]: Nothing to be done for 'check'.
make[1]: Leaving directory '/home/pi/bcm2835-1.71/doc'
make[1]: Entering directory '/home/pi/bcm2835-1.71'
make[1]: Leaving directory '/home/pi/bcm2835-1.71'
Making install in src
make[1]: Entering directory '/home/pi/bcm2835-1.71/src'
make[2]: Entering directory '/home/pi/bcm2835-1.71/src'
 /usr/bin/mkdir -p '/usr/local/lib'
 /usr/bin/install -c -m 644  libbcm2835.a '/usr/local/lib'
 ( cd '/usr/local/lib' && ranlib libbcm2835.a )
 /usr/bin/mkdir -p '/usr/local/include'
 /usr/bin/install -c -m 644 bcm2835.h '/usr/local/include'
make[2]: Leaving directory '/home/pi/bcm2835-1.71/src'
make[1]: Leaving directory '/home/pi/bcm2835-1.71/src'
Making install in doc
make[1]: Entering directory '/home/pi/bcm2835-1.71/doc'
make[2]: Entering directory '/home/pi/bcm2835-1.71/doc'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/home/pi/bcm2835-1.71/doc'
make[1]: Leaving directory '/home/pi/bcm2835-1.71/doc'
make[1]: Entering directory '/home/pi/bcm2835-1.71'
make[2]: Entering directory '/home/pi/bcm2835-1.71'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/home/pi/bcm2835-1.71'
make[1]: Leaving directory '/home/pi/bcm2835-1.71'

@SSYYL
Copy link
Collaborator

SSYYL commented Nov 28, 2022

@MatejBosansky, I found the problem.
It is that the .so files compiled on 32-bit and 64-bit systems are not compatible.
I will update it later, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants