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 3 compatibility #6

Closed
fgugliuzza opened this issue May 17, 2020 · 7 comments
Closed

Python 3 compatibility #6

fgugliuzza opened this issue May 17, 2020 · 7 comments
Labels
type: enhancement New feature or request

Comments

@fgugliuzza
Copy link

The plugin can't be enabled when OctoPrint 1.4.0 is running on Python 3, because it is not reported as compatible. I think it could be ported to Python 3 with relative ease, by wrapping a filter() call with list() and at most a couple of other modifications.

I tried doing this myself but when I install via zip file OctoPrint incorrectly reports plugin name as "(Unknown)" and doesn't show it in the plugin list.

Any idea on how to install the plugin on Python 3 systems?

@OllisGit OllisGit added the type: enhancement New feature or request label May 20, 2020
@OllisGit
Copy link
Owner

Hi @fgugliuzza ,

how did you zip the plugin? You need to zip from the root folder.
As minimum it must include setup.py, requirements.txt and the octoprint_DryRun - folder.

Then everything should be deployable.

Or just attach your zip-file, then I can verify the file.

BR
Olli

@OllisGit
Copy link
Owner

Hi @fgugliuzza ,

btw. I am using the gcode-testmode from Octolaps, thats the reason why I ask the author to fix the py3-issue.
See FormerLurker/Octolapse#525

@fgugliuzza
Copy link
Author

fgugliuzza commented May 23, 2020

Hi! Sorry for the delay in the reply, I was very busy these days.
Anyway, I made the zip from the root folder as you said and attached it here master-python3.zip. The only modifications to the code are the python 3 "flags" for OctoPrint in __init__.py:
__plugin_pythoncompat__ = ">=2.7,<4"
and a wrap of filter() using list() in gcode_parser.py (that I have yet to test, though):
if any(list(filter(parameters.has_key, additional_parameters.keys()))):
I'm still getting the Unknown plugin name message, and I've attached it too as an image.
immagine

I've performed all this on Windows, could it be the cause? Maybe the zip or some permissions get corrupted?

@OllisGit
Copy link
Owner

Hi @fgugliuzza ,
I just take a short look to your plugin:

  • I installed your zip on my system.
  • I have the same popup. Ignore it. This is an OctoPrint-Issue.
  • But your plugin is not working, because in Pyhon3 the import-statements looks different.
    Error-Message:
/OctoPrint/octoprint_latest/venv-3/lib/python3.6/site-packages/octoprint_DryRun/gcode_parser.py", line 26, in <module>
    import utility
ModuleNotFoundError: No module named 'utility'

Correct-Statement

from octoprint_DryRun import utility

I didn't looked into your list-change in detail, but you need to replace the has_key statement, it is not available any more (https://docs.python.org/3.1/whatsnew/3.0.html#builtins)

You can also look into my solution (see Octolaps-Issue for more details)

OllisGit added a commit that referenced this issue May 25, 2020
@OllisGit
Copy link
Owner

I released a new Version 1.2.0.

Please test and give me a feedback.

Thx, in advance
Olli

@OllisGit OllisGit added the status: waitingForFeedback Wating for Customers feedback label May 25, 2020
@fgugliuzza
Copy link
Author

I just installed it and run a dry print. It works great!
Thank you very much for your time!

Best regards
Francesco

@OllisGit
Copy link
Owner

You'r welcome!

@OllisGit OllisGit removed the status: waitingForFeedback Wating for Customers feedback label May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants