Menu

#475 Newest Version Is Unable To Import Archive_load Function

next release
open
None
5
2023-02-14
2023-02-11
No

I seem to not be able to load certain functions after the2023-01-24 version update. On my machine, when I run from psrchive import Archive_load I get ImportError: cannot import name 'Archive_load' from 'psrchive' (/opt/python/3.9/envs/pulsar/lib/python3.10/site-packages/psrchive.py) which was not happening in previous updates.

Related

Bugs: #475

Discussion

  • Jacob Turner

    Jacob Turner - 2023-02-11

    I should also mention that despite this I am able to run import psrchive just fine, but then the Archive_load function seems to be missing if I try to access it that way. When I run import psrchive; psrchive.Archive_load(filename) I get AttributeError: modile 'psrchive' has no attribute 'Archive_load'

     
  • Paul Demorest

    Paul Demorest - 2023-02-13

    hi Jacob, sorry for the trouble, I will take a look today. I assume you are using the conda-forge package?

     
    • Jacob Turner

      Jacob Turner - 2023-02-13

      Hi Paul,

      Yes, that’s correct, we are using conda-forge.

      Jacob

      On Mon, Feb 13, 2023 at 11:07 Paul Demorest demorest@users.sourceforge.net
      wrote:

      hi Jacob, sorry for the trouble, I will take a look today. I assume you
      are using the conda-forge package?


      Status: open
      Group: next release
      Created: Sat Feb 11, 2023 05:12 PM UTC by Jacob Turner
      Last Updated: Sat Feb 11, 2023 05:26 PM UTC
      Owner: nobody

      I seem to not be able to load certain functions after the2023-01-24
      version update. On my machine, when I run from psrchive import
      Archive_load I get ImportError: cannot import name 'Archive_load' from
      'psrchive'
      (/opt/python/3.9/envs/pulsar/lib/python3.10/site-packages/psrchive.py)
      which was not happening in previous updates.


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/psrchive/bugs/475/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #475

  • Paul Demorest

    Paul Demorest - 2023-02-13
    • assigned_to: Paul Demorest
     
  • Paul Demorest

    Paul Demorest - 2023-02-13

    Just investigated a bit, it appears that psrchive.Archive.load() works with the new version in place of psrchive.Archive_load(). So that can be used as a short-term workaround. This is almost certainly due to a swig version change, I will work on making a new package that supports the previous syntax (either in place of or in addition to the new).

     
    • Jacob Turner

      Jacob Turner - 2023-02-14

      Got it. Thanks for checking!

      On Mon, Feb 13, 2023 at 18:07 Paul Demorest demorest@users.sourceforge.net
      wrote:

      Just investigated a bit, it appears that psrchive.Archive.load() works
      with the new version in place of psrchive.Archive_load(). So that can be
      used as a short-term workaround. This is almost certainly due to a swig
      version change, I will work on making a new package that supports the
      previous syntax (either in place of or in addition to the new).


      Status: open
      Group: next release
      Created: Sat Feb 11, 2023 05:12 PM UTC by Jacob Turner
      Last Updated: Mon Feb 13, 2023 04:07 PM UTC
      Owner: Paul Demorest

      I seem to not be able to load certain functions after the2023-01-24
      version update. On my machine, when I run from psrchive import
      Archive_load I get ImportError: cannot import name 'Archive_load' from
      'psrchive'
      (/opt/python/3.9/envs/pulsar/lib/python3.10/site-packages/psrchive.py)
      which was not happening in previous updates.


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/psrchive/bugs/475/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #475

  • Paul Demorest

    Paul Demorest - 2023-02-14

    One more bit of info for the record, this change appeared in swig 4.1.0. From https://www.swig.org/Release/CHANGES:

    2022-03-21: jschueller, jim-easterbrook, wsfulton
                [Python] #2137 C++ static member functions no longer generate a "flattened"
                name in the Python module. For example:
    
                  s = example.Spam()
                  s.foo()               # Spam::foo() via an instance
                  example.Spam.foo()    # Spam::foo() using class method
                  example.Spam_foo()    # Spam::foo() "flattened" name
    
                The "flattened" name is no longer generated, but can be generated
                by using the new -flatstaticmethod option.
    
                *** POTENTIAL INCOMPATIBILITY ***
    

    I'll get a new build going soon that enables this option for backwards compatibility.

     
  • Paul Demorest

    Paul Demorest - 2023-02-14

    OK there is a new conda-forge package (still v2023.01.24, build number 4) that enables the relevant option and restores Archive_load(). Useful to note that Archive.load() also works, so that may be a more "future-proof" choice, and any modifications made in the past day don't necessarily need to be reverted.

    I'll leave this ticket open for now since this should eventually be addressed in psrchive configure as well, to automatically enable -flatstaticmethod when swig version >= 4.1.0.

     

Log in to post a comment.

MongoDB Logo MongoDB