malnvenshorn / OctoPrint-FilamentManager

OctoPrint plugin to manage your filament inventory
GNU Affero General Public License v3.0
131 stars 60 forks source link

adds python 3.7 compatibility #201

Open benjamin-salchow opened 4 years ago

benjamin-salchow commented 4 years ago

I upgraded to Python 3.7 and I could not run your plug-in.

I got the following error: "Plugin Filament Manager (0.5.3) is not compatible to Python 3.7.3 (compatibility string: >=2.7,<3)."

So I just added the __plugin_pythoncompat__ information and run this plugin. I just needed to add the UTF-8 encoding within your entity_tag function. Now it works like a charm with Python 3.7.3 and I had no issue with my OctoPrint setup.

benjamin-salchow commented 4 years ago

There is still a little issue with python3:

Traceback (most recent call last):
  File "/home/octopi/OctoPrint/venv/lib/python3.7/site-packages/OctoPrint-1.4.0-py3.7.egg/octoprint/plugin/__init__.py", line 224, in call_plugin
    result = getattr(plugin, method)(*args, **kwargs)
  File "/home/octopi/OctoPrint/venv/lib/python3.7/site-packages/octoprint_filamentmanager/__init__.py", line 225, in on_event
    self.on_printer_state_changed(payload)
  File "/home/octopi/OctoPrint/venv/lib/python3.7/site-packages/octoprint_filamentmanager/__init__.py", line 245, in on_printer_state_changed
    self.update_filament_usage()
  File "/home/octopi/OctoPrint/venv/lib/python3.7/site-packages/octoprint_filamentmanager/__init__.py", line 260, in update_filament_usage
    for tool in xrange(0, numTools):
NameError: name 'xrange' is not defined
benjamin-salchow commented 4 years ago

Last check-in fixes commented error by using range instead of xrange.

NovaViper commented 4 years ago

Hey @benjamin-salchow how do I add your branch onto Octoprint?

benjamin-salchow commented 4 years ago

@NovaViper Hello, you can use my branch by installing it with the URL:

https://github.com/benjamin-salchow/OctoPrint-FilamentManager/archive/master.zip

This contains all changes in this pull request. Just install it from this zip and later change it to the official if this gets included someday - hopefully ;-)

NovaViper commented 4 years ago

@benjamin-salchow Hey, thanks for the link! Um, I installed the plugin but it still says it's not Python 3 with the Python 3 Checker plugin

NovaViper commented 4 years ago

In fact, it still goes and installs the original plugin and not the modified one

benjamin-salchow commented 4 years ago

Hello @NovaViper - the Python 3 Checker plug-in is useless. This plugin just takes a look in the official registry at Octoprint of the plugin. That's the reason why my fix is not listed, because my plugin is just a fork from this one. If you delete the original one and install the zip from my fork it should work. I did the same on my 3D-Printer and it works fine :-).

buffedelic commented 3 years ago

I can confirm that changes made by @benjamin-salchow is working for octoprint 1.4.0. Merge!

sr1329 commented 3 years ago

Hi I'm really confused. Has this been merged into the main branch? If I want to use this branch how do I install it? When I check inside the branch I see the author has linked to the main branch zip file.

How do I install this version?