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

global name 'CustomTimeFormat' is not defined error #12

Closed
MisterGlass opened this issue Aug 6, 2020 · 5 comments
Closed

global name 'CustomTimeFormat' is not defined error #12

MisterGlass opened this issue Aug 6, 2020 · 5 comments
Labels
bug Something isn't working

Comments

@MisterGlass
Copy link

MisterGlass commented Aug 6, 2020

Describe the bug
I noticed this error in my logs while developing with the virtual printer. It appears the calculate_eta function is using a global that is set in the event handler, and there is a race condition.

To Reproduce
Steps to reproduce the behavior:

  1. Switch octoprint to the virtual printer
  2. Print something (virtually)
  3. Open octoprint.log
  4. See error

Expected behavior
I think this bug can be avoided my moving the global instantiation to the class init function. That would ensure it is always set.

Screenshots
N/A

Environment information:

  • Octoprint Version: 1.4.1
  • Browser: N/A
  • Python Version: 2

Additional context

Traceback (most recent call last):
  File "/home/pi/devel/OctoPrint/src/octoprint/printer/standard.py", line 241, in call_plugins
    plugin.on_print_progress(storage, filename, progress)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_display_eta/__init__.py", line 60, in on_print_progress
    self.eta_string = self.calculate_ETA()
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_display_eta/__init__.py", line 47, in calculate_ETA
    strtime = format_time(finish_time,CustomTimeFormat)
NameError: global name 'CustomTimeFormat' is not defined
@MisterGlass MisterGlass added the bug Something isn't working label Aug 6, 2020
@AlexVerrico
Copy link
Owner

Hi @MisterGlass
I have been unable to replicate this issue with my installation of Octoprint 1.40 running on Python 3.7, however I believe that I have fixed the issue.
Can you please try installing the plugin from this link https://github.com/AlexVerrico/Octoprint-Display-ETA/archive/devel.zip and see if that fixes it.
Cheers,
Alex.

@MisterGlass
Copy link
Author

Now I am receiving an error that doM117 is not defined.

@AlexVerrico
Copy link
Owner

Hi @MisterGlass
Sorry for not replying sooner, issue should now be fixed in the development branch.
Can you please try installing the plugin from this link https://github.com/AlexVerrico/Octoprint-Display-ETA/archive/devel.zip and see if that fixes it.
Cheers,
Alex.

@AlexVerrico
Copy link
Owner

HI @MisterGlass
Can you please let me know if this solved your problem so that I can close the issue.
Cheers,
Alex.

@MisterGlass
Copy link
Author

I only had time for a quick test but it seems to be working now. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants