jneilliii / OctoPrint-RTMPStreamer

22 stars 13 forks source link

Python 3 Compatibility #25

Closed CobaltEcho closed 3 years ago

CobaltEcho commented 3 years ago

I've been trying to install this on my Pi (version below), and after a while I found that OctoPrint says it's incompatable. Any idea why, or what I need to do?

Raspberry Pi 4, Model B, Rev 1.4, 8BG RAM OctoPi Version 0.18.0, running on Raspberry Pi 4 Model B Rev 1.4 OctoPrint Version 1.5.2

RTMPStreamer

jneilliii commented 3 years ago

It's python 3 compatibility related. Because you installed octopi 0.18 is utilizes python 3 by default. If you want to test this out for me (I don't use the plugin) you can install the rc branch here to see if it works for you or not. If it does then I can release an official stable version for python 3. Copy/Paste the URL below into Plugin Manager > Get More > ...from URL and click Install.

https://github.com/jneilliii/OctoPrint-RTMPStreamer/archive/0.1.5rc1.zip
Duckle29 commented 3 years ago

I tried installing from that url, but it still somehow gets that the compatability is >=2.7, <3, even tho it's clearly set as <4 in the source I've tried installing with --no-binary :all: as well, but same story Also tried re-installing with --no-deps --upgrade --force_reinstall no dice

jneilliii commented 3 years ago

Are there any errors in the octoprint.log?

Duckle29 commented 3 years ago

Okay, forcing it compatible via config.yaml, and it is indeed not compatible

Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/plugin/core.py", line 762, in _parse_metadata
    root = ast.parse(f.read(), filename=path)
  File "/usr/lib/python3.7/ast.py", line 35, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_rtmpstreamer/__init__.py", line 26
    except Exception, e:
                    ^
SyntaxError: invalid syntax

Updating this syntax to python3 seems to let it start. Currently installing docker to test it out

jneilliii commented 3 years ago

cool, be happy to accept a PR against the RC branch if you do get it working. That was a slight oversight on my part.

Duckle29 commented 3 years ago

so the docker container can stream just fine, however trying to start it from the plugin doesn't seem to spawn any docker containers, and there doesn't seem to be anything thrown up in the log.

On the first try it "started" the stream and gave me a stop button, hitting the stop button gave a 404 no such container and a container hash. Second try it just kept spinning on start.

jneilliii commented 3 years ago

Ok, I'll have to look into it later then.

jneilliii commented 3 years ago

This is resolved in the above commit. I've tested on my octopi 0.18 install that is Python 3 out of the box. You should be able to switch the release channel to Release Candidate in OctoPrint's Software Update settings and update to version 0.1.5rc2 to verify. I am still investigating #24 which has rendered the embedded viewer tab useless, but the stream does still start as expected.

Duckle29 commented 3 years ago

Awesome. Will give it a test in a day or two :)

Duckle29 commented 3 years ago

It works for streaming, preview as you said doesn't work :) Had to install it from github directly though, as I couldn't install the stable version and then promote it to RC.

jneilliii commented 3 years ago

Thanks @Duckle29 official release version out now with those changes integrated. I'll get the plugin repo updated so it shows as being compatible from there too.