labscript-suite-temp / labscript_utils

Shared modules used by the labscript suite. Includes a graphical exception handler, debug tools, configuration management, cross platform filepath conversions, unit conversions and custom GUI widgets.
Other
0 stars 0 forks source link

Module importlib_metadata is not in installer dependency list #25

Closed philipstarkey closed 5 years ago

philipstarkey commented 5 years ago

Original report (archived issue) by Shaun Johnstone (Bitbucket: shjohnst, GitHub: shjohnst).


importlib_metadata is now required when using Python 2.7, so it should be added to the installer dependency list. Also, when updating from an older combination of BLACS and labscript_utils, the error when this module is missing is silent when not running from a terminal - BLACS will simply fail to open. Is it possible to catch this? Obviously the main solution is to encourage everyone to move to Python 3!

philipstarkey commented 5 years ago

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


Kind of a chicken and egg since importlib_metadata is used by the check_version functionality! But I can probably move some imports into the functions that use them so that importlib_metadata is imported lazily, then the graphical excepthook will be set up before the error occurs, and have the exception say what the required version is.

Also will add it to the installer's requirements. Even in Python 3 it's not a stdlib module - it only will be in 3.8. 3.8 comes out soon so I'll have to special case it in the dependency checking so that it is not listed as an external requirement if you're on 3.8.

philipstarkey commented 5 years ago

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


The silent exception should be addressed by PR #88, which lazily imports importlib_metadata so that you don't get errors until it is actually used (by which time the excepthook will have been set up if running graphically).

philipstarkey commented 5 years ago

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


Fixed in installer PR #15 and labscript_utils PR #88

philipstarkey commented 5 years ago

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).