konikvranik / pyCEC

:vhs: Library providing object acces to HDMI CEC devices
MIT License
50 stars 19 forks source link

error starting pycec server python3 -m pycec #51

Open rocksolid2018 opened 6 years ago

rocksolid2018 commented 6 years ago

pi@raspberrypi:~ $ python3 -m pycec Traceback (most recent call last): File "/usr/lib/python3.5/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/usr/lib/python3.5/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/pi/.local/lib/python3.5/site-packages/pycec/main.py", line 164, in main() File "/home/pi/.local/lib/python3.5/site-packages/pycec/main.py", line 32, in main network = HDMINetwork(CecAdapter("pyCEC", activate_source=False), File "/home/pi/.local/lib/python3.5/site-packages/pycec/cec.py", line 20, in init import cec ImportError: No module named 'cec'

codymhorton commented 6 years ago

I get this error as well. In the instructions it "When using pyCEC as a network client, libcec is not needed" but when I run the command python3 -m pycec is instantly errors out because it is not there. @konikvranik can you advise and possible update the instructions?

Also by default when installing libcec it puts it in python2.7 but it looks like pycec is designed for python3.

codymhorton commented 6 years ago

I was able to get it to work but again it does require libcec. If you look at this comment I explain how I was able to get it to work: https://github.com/konikvranik/pyCEC/issues/50#issuecomment-421468331

rocksolid2018 commented 6 years ago

codymhorton, please guide some steps as i am not sure of the fix.

codymhorton commented 6 years ago

So the comment I linked to mentions installing someone else's repo. I'm installing for rasberry pi so I used this documentation: https://github.com/Pulse-Eight/libcec/blob/master/docs/README.raspberrypi.md

The instructions are:

sudo apt-get update sudo apt-get install cmake libudev-dev libxrandr-dev python-dev swig cd git clone https://github.com/Pulse-Eight/platform.git mkdir platform/build cd platform/build cmake .. make sudo make install cd git clone https://github.com/blkeller/libcec.git (this is the line that changes) mkdir libcec/build cd libcec/build cmake -DRPI_INCLUDE_DIR=/opt/vc/include -DRPI_LIB_DIR=/opt/vc/lib .. (when you run this you'll notice it says Python3 instead of 2.7) make -j4 sudo make install sudo ldconfig

Once you do this it install in Python3 packages so you can run python3 -m pycec without the error.