Moonbase59 / studiodisplay

A fast, modular MQTT-based signalling & display solution for Web Radio Stations using IDJC. Or just to make your smart home even smarter.
GNU General Public License v3.0
22 stars 4 forks source link

Import error mqtt-idjc.py #2

Closed rallep71 closed 6 years ago

rallep71 commented 6 years ago

./mqtt-idjc.py Traceback (most recent call last): File "./mqtt-idjc.py", line 61, in from idjcmonitor import IDJCMonitor ModuleNotFoundError: No module named 'idjcmonitor'

Moonbase59 commented 6 years ago

Typical reason:

You’re trying to run mqtt-idjc.py on a machine that has no IDJC installed.
It must be run on the machine that runs IDJC (IDJC installs 'idjcmonitor').

rallep71 commented 6 years ago

IDJC is installed on the computer, otherwise I would not have written it, the idjcmon.py also works, http://idjc.sourceforge.net/code_idjcmon.html

I have Arch, IDJC version 0.8.17, and yes, I installed the IDJC first, it's been running for quite a while.

I use python3, so I also had to change the mqtt-idjc.py.

Hostname is also clear, I created a cfg for it.

nevertheless I get the "new" message that the IDJC must run on the same machine and the IDJC must be installed first

Moonbase59 commented 6 years ago

Apparently IDJC installs idjcmonitor only for Python2, that’s why mqtt-idjc.py also uses Python2.

EDIT: Just checked on my (Linux Mint and Ubuntu Studio) systems, and idjcmonitor.py got installed on both of them under /usr/lib/python2.7/dist-packages/. Tried copying it to the respective Python3 folder, but the code of idjcmonitor.py produces errors under Python3.

If you really require Python3, maybe open a ticket with Stephen at https://sourceforge.net/p/idjc/support-requests/?source=navbar.

rallep71 commented 6 years ago

ok

rallep71 commented 6 years ago

in the script

!/usr/bin/env python

superseded by

! /usr/bin/python2.7

I should have noticed right away; ) I've only been irritated by the following line: import configparser # Py2: ConfigParser; Py3: configparser

ok, sometimes it's a little different when you use arch, thanks anyway, I'll get it up and running )

im script

!/usr/bin/env python

ersetzt mit

! /usr/bin/python2.7

hätte mir auch gleich auffallen müssen, ;) mich hat nur folgende zeile irritiert: import configparser # Py2: ConfigParser; Py3: configparser

ok, ist halt manchmal ein wenig anders wenn man arch benutz, trotzdem danke, werd es schon zum laufen bringen ;)

Moonbase59 commented 6 years ago

So true, and yes, I’m sure you’ll get it running ;-)

Are you saying that your default Python is already Python3? (If you call up python, you get Python3?)

If that is actually the case, I’d be happy to change the shebangs for Python2 code to

#!/usr/bin/env python2

which I would recommend you doing, too, instead of relying on Python being in /usr/bin and a specific version.

Moonbase59 commented 6 years ago

Thanks for the feedback, reworked all shebangs in https://github.com/Moonbase59/studiodisplay/commit/987104a808d4566a4ed43801b63238504f719025

When calling one of the Python modules directly (as I suggest in the docs), it should now invoke the correct Python interpreter (version 2.x or 3.x).

rallep71 commented 6 years ago

Arch's standard is python -V Python 3.6.5

whereby I also have python 2 parallel at the start,

I would say the code

!/usr/bin/env python2 in the scripts would make sense, would be a clear announcement.

Moonbase59 commented 6 years ago

FYI: Added some info for non-Debian-like installations in docs/install-non-debian.md.