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

Getting AttributeError: 'PathsWrapper' object has no attribute '_path' #235

Open
mgeplf opened this issue Feb 14, 2022 · 4 comments
Open

Comments

@mgeplf
Copy link

mgeplf commented Feb 14, 2022

Code from running: https://bbpgitlab.epfl.ch/molsys/bbp_me_type_to_mol_id/-/blob/main/downloader/BBP_downloader.py is causing the following exception:

Enter NEXUS token                                                                                                                                                                                                                                                               
seaching morphologies...                                                                                                                                
Traceback (most recent call last):                               
  File "BBP_downloader.py", line 23, in <module>                                                                                        
    path.annotation.hasBody.type == "MType",                                                                                                                                                                                                                                    
  File "/home/gevaert/src/nexus-forge/kgforge/core/wrappings/paths.py", line 70, in __eq__                                              
    return self._for(FilterOperator.EQUAL.value, other)                                                                                 
  File "/home/gevaert/src/nexus-forge/kgforge/core/wrappings/paths.py", line 82, in _for  
    return Filter(self._path, operator, other)                  
AttributeError: 'PathsWrapper' object has no attribute '_path'  

I believe it's because the __dict__ is being reset here:
https://github.com/BlueBrain/nexus-forge/blob/master/kgforge/core/wrappings/paths.py#L94

@mgeplf
Copy link
Author

mgeplf commented Feb 14, 2022

We normally don't access/modify the __dict__ member, and I think it would be worthwhile to audit nexus-forge for usages of it.

@MFSY
Copy link
Collaborator

MFSY commented Feb 14, 2022

Hi @mgeplf ,

Thanks for reporting this. This is a known issue(#26). We'll look into it. We need to rework that part of the code. Meanwhile, you can use:

  • path.annotation.hasBody.type.id instead of path.annotation.hasBody.type
  • or one of the two other search filter syntax supported by forge as shown in this notebook (section 'Searching') or in the doc

@MFSY
Copy link
Collaborator

MFSY commented Feb 14, 2022

Duplicate issue #26

@mgeplf
Copy link
Author

mgeplf commented Feb 14, 2022

Meanwhile, you can use:

I'm pretty sure it's due to overwriting the __dict__ member that is causing the problem. Updating it w/ self.__dict__.update(paths) (which I consider a bad idea, b/c I'm not checking what is all in paths) seems to fix the problem.

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

No branches or pull requests

2 participants