Skip to content

remove deprecated/removed numpy warning#1667

Open
barentine wants to merge 4 commits into
python-microscopy:masterfrom
barentine:removedwarning
Open

remove deprecated/removed numpy warning#1667
barentine wants to merge 4 commits into
python-microscopy:masterfrom
barentine:removedwarning

Conversation

@barentine
Copy link
Copy Markdown
Member

Addresses issue Opening the annotation module in PYMEImage fails on later numpy's

DEBUG:PYME.ui.AUIFrame:Creating fold panel
Traceback (most recent call last):
  File "C:\Userfiles\andrew\code\python-microscopy\PYME\DSView\dsviewer.py", line 236, in OnToggleModule
    self.LoadModule(mn)
  File "C:\Userfiles\andrew\code\python-microscopy\PYME\DSView\dsviewer.py", line 243, in LoadModule
    modules.loadModule(moduleName, self)
  File "C:\Userfiles\andrew\code\python-microscopy\PYME\DSView\modules\__init__.py", line 122, in loadModule
    _load_mod(mod, modName, dsviewer)
  File "C:\Userfiles\andrew\code\python-microscopy\PYME\DSView\modules\__init__.py", line 133, in _load_mod
    ret = mod.Plug(parent)
          ^^^^^^^^^^^^^^^^
  File "C:\Userfiles\andrew\code\python-microscopy\PYME\DSView\modules\annotation.py", line 725, in Plug
    return Annotater(dsviewer)
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Userfiles\andrew\code\python-microscopy\PYME\DSView\modules\annotation.py", line 599, in __init__
    self.view.add_overlay(self.DrawOverlays, 'Annotations')
  File "C:\Userfiles\andrew\code\python-microscopy\PYME\DSView\arrayViewPanel.py", line 1030, in add_overlay
    warnings.warn(numpy.VisibleDeprecationWarning('using old-style overlay function, please re-write as a class'))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\aesb\AppData\Local\miniforge3\envs\pipyme311\Lib\site-packages\numpy\__init__.py", line 805, in __getattr__
    raise AttributeError(f"module {__name__!r} has no attribute {attr!r}")
AttributeError: module 'numpy' has no attribute 'VisibleDeprecationWarning'

Is this a bugfix or an enhancement?
bugfix
Proposed changes:
remove the removed numpy VisibleDeprecationWarning and pass DeprecationWarning as the category

@barentine
Copy link
Copy Markdown
Member Author

Note that there are two instances of the same warning that should be removed in tabular.py

@David-Baddeley
Copy link
Copy Markdown
Contributor

Hmm, I think the reason I moved to VisibleDeprecationWarning was that a lot of the straight DeprecationWarnings were getting hidden somehow. Might need to check this. I'll probably merge anyway to make it work with recent numpy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants