I'm following the plugin development tutorial on this page xxx but I'm getting this error in the logs:
WARNING - Plugin XYZ can't be compiled under Python 3.7.3 due to invalid syntax
This is both the case whether I put xyz.py in the plugin folder or whether I run the octoprint dev plugin:install
command
Any ideas what's happening here?
Invalid syntax means there's something wrong with the code you've written, maybe a typo or missing character.
If you can't find it yourself, upload the file you've created so we can see.
Charlie_Powell:
e file you'
I literally copy/pasted the code off the page
https://docs.octoprint.org/en/master/plugins/gettingstarted.html
I should also mention that I was able to get this to work last week on the same machine tho with a lot of troubleshooting... so last night i sat down to do it again to learn the concepts and this time I'm getting this problem which is new.
Here's my code:
'
-- coding: utf-8 - -
from future import absolute_import, unicode_literals
import octoprint.plugin
class DampooPlugin(octoprint.plugin.StartupPlugin,
octoprint.plugin.TemplatePlugin,
octoprint.plugin.SettingsPlugin):
def on_after_startup(self):
self._logger.info("Hello World! (more: %s)" % self._settings.get(["url"]))
def get_settings_defaults(self):
return dict(url="https://en.wikipedia.org/wiki/Hello_world")
def get_template_configs(self):
return [
dict(type="navbar", custom_bindings=False),
dict(type="settings", custom_bindings=False),
dict(type="sidebar", custom_bindings=True)
plugin_name = "OctoPrint-Dampoo"
plugin_version = "1.0.0"
plugin_description = "Let's Damp it together for OctoPrint"
plugin_pythoncompat = ">=2.7,<4"
plugin_implementation = DampooPlugin()
'
octoprint.log (20.9 KB)
for some reason I can't paste my code here properly and it won't let me upload - here it is again in raw format
-- coding: utf-8 - -
from future import absolute_import, unicode_literals
import octoprint.plugin
class DampooPlugin(octoprint.plugin.StartupPlugin,
octoprint.plugin.TemplatePlugin,
octoprint.plugin.SettingsPlugin):
def on_after_startup(self):
self._logger.info("Hello World! (more: %s)" % self._settings.get(["url"]))
def get_settings_defaults(self):
return dict(url="https://en.wikipedia.org/wiki/Hello_world")
def get_template_configs(self):
return [
dict(type="navbar", custom_bindings=False),
dict(type="settings", custom_bindings=False),
dict(type="sidebar", custom_bindings=True)
plugin_name = "OctoPrint-Dampoo"
plugin_version = "1.0.0"
plugin_description = "Let's Damp it together for OctoPrint"
plugin_pythoncompat = ">=2.7,<4"
plugin_implementation = DampooPlugin()
j7126
October 22, 2021, 7:43am
5
This could be just due to how it was pasted into the post here, but it looks like your on_after_startup function is missing indentation.
Here's the code in pastebin:
and looks like you're right; i'm missing the ] at the end!