owebeeone / anchorscad

A Python 3D modelling API for generating OpenSCAD source code. This library simplifies the creating of 3D models and contains a suite of completed models including Raspberry Pi cases and other models.
39 stars 3 forks source link

'MaterialMap' has no attribute '__annotations__' #1

Open zstreeter opened 3 weeks ago

zstreeter commented 3 weeks ago

Hi there!

Looking forward to using this project to start creating some CAD projects! Really appreciate your effort!

I followed the install instructions and tried out the verification step but resulted in the following error

  File "/home/zstreet/Documents/Repos/anchorscad/src/anchorscad/extrude.py", line 13, in <module>
    import anchorscad.core as core
  File "/home/zstreet/Documents/Repos/anchorscad/src/anchorscad/__init__.py", line 2, in <module>
    from .core import *
  File "/home/zstreet/Documents/Repos/anchorscad/src/anchorscad/core.py", line 273, in <module>
    class MaterialMap:
  File "/home/zstreet/Documents/Repos/anchorscad/src/anchorscad/datatrees.py", line 959, in wrap
    return _process_datatree(
  File "/home/zstreet/Documents/Repos/anchorscad/src/anchorscad/datatrees.py", line 876, in _process_datatree
    if OVERRIDE_FIELD_NAME in clz.__annotations__:
AttributeError: type object 'MaterialMap' has no attribute '__annotations__'

Looks like the clz class isn't being initialized correctly or something.

I'm also seeing this on the stable branch as well so I'm thinking this is on my side. Any advice would be appreciated!

owebeeone commented 3 weeks ago

Thanks for letting me know. I'm not sure. it should be working. I'll have a look tonight.

Which version of python are you using? Anchorscad makes heavy use of dataclasses and that's changed somewhat. Come to think of it, anotations is Python's place to put annotation metadata. Unless that's now changed (maybe but I think unlikely) it probably means you need a more recent version of Python. anotations is used in a couple of places, including the datatrees module to check the override field state which is what seems to be happening here.

On an aside, totally won't fix your issue: I've recently (like yesterday) rehashed this stuff and added Part support

If you're interested in looking at the most recent stuff (still working on a few fixes but it builds all the modules bar 2 seem to work, checkout the dev-fobm-pmc https://github.com/owebeeone/anchorscad/tree/dev-fobm-pmc branch. You'll need the latest (master) pythonopenscad branch too.

On Fri, Aug 23, 2024 at 10:56 AM Zachary Streeter @.***> wrote:

Hi there!

Looking forward to using this project to start creating some CAD projects! Really appreciate your effort!

I followed the install instructions and tried out the verification step but resulted in the following error

File "/home/zstreet/Documents/Repos/anchorscad/src/anchorscad/extrude.py", line 13, in import anchorscad.core as core File "/home/zstreet/Documents/Repos/anchorscad/src/anchorscad/init.py", line 2, in from .core import * File "/home/zstreet/Documents/Repos/anchorscad/src/anchorscad/core.py", line 273, in class MaterialMap: File "/home/zstreet/Documents/Repos/anchorscad/src/anchorscad/datatrees.py", line 959, in wrap return _process_datatree( File "/home/zstreet/Documents/Repos/anchorscad/src/anchorscad/datatrees.py", line 876, in _process_datatree if OVERRIDE_FIELD_NAME in clz.annotations: AttributeError: type object 'MaterialMap' has no attribute 'annotations'

Looks like the clz class isn't being initialized correctly or something.

I'm also seeing this on the stable branch as well so I'm thinking this is on my side. Any advice would be appreciated!

— Reply to this email directly, view it on GitHub https://github.com/owebeeone/anchorscad/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACZQHMZ6QKV4KSTKJSUFO3ZS2CDTAVCNFSM6AAAAABM7GAQESVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ4DEMBTHE2TQOI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

owebeeone commented 3 weeks ago

Hi Zachary,

https://docs.python.org/3/howto/annotations.html describes how to use annotations which makes this an official Python API for classes (and other things) since Python 3.0.

That would mean you're likely using Python 2.x which is not supported by AnchorSCAD. Sometimes both Python 2x and 3x are installed at the same time. Python 3.x can usually be accessed using the python3 command. See if that works for you.

Best Regards g

On Fri, Aug 23, 2024 at 4:18 PM Gianni Mariani @.***> wrote:

Thanks for letting me know. I'm not sure. it should be working. I'll have a look tonight.

Which version of python are you using? Anchorscad makes heavy use of dataclasses and that's changed somewhat. Come to think of it, anotations is Python's place to put annotation metadata. Unless that's now changed (maybe but I think unlikely) it probably means you need a more recent version of Python. anotations is used in a couple of places, including the datatrees module to check the override field state which is what seems to be happening here.

On an aside, totally won't fix your issue: I've recently (like yesterday) rehashed this stuff and added Part support

  • (i.e. the pair Part and Material). The MaterialMap has changed. The idea is the you can associate a "part" name and priority and material and priority and it will create multiple .scad files, one for each part and one for "all". All this should not be affecting the stable to master branches.

If you're interested in looking at the most recent stuff (still working on a few fixes but it builds all the modules bar 2 seem to work, checkout the dev-fobm-pmc https://github.com/owebeeone/anchorscad/tree/dev-fobm-pmc branch. You'll need the latest (master) pythonopenscad branch too.

On Fri, Aug 23, 2024 at 10:56 AM Zachary Streeter < @.***> wrote:

Hi there!

Looking forward to using this project to start creating some CAD projects! Really appreciate your effort!

I followed the install instructions and tried out the verification step but resulted in the following error

File "/home/zstreet/Documents/Repos/anchorscad/src/anchorscad/extrude.py", line 13, in import anchorscad.core as core File "/home/zstreet/Documents/Repos/anchorscad/src/anchorscad/init.py", line 2, in from .core import * File "/home/zstreet/Documents/Repos/anchorscad/src/anchorscad/core.py", line 273, in class MaterialMap: File "/home/zstreet/Documents/Repos/anchorscad/src/anchorscad/datatrees.py", line 959, in wrap return _process_datatree( File "/home/zstreet/Documents/Repos/anchorscad/src/anchorscad/datatrees.py", line 876, in _process_datatree if OVERRIDE_FIELD_NAME in clz.annotations: AttributeError: type object 'MaterialMap' has no attribute 'annotations'

Looks like the clz class isn't being initialized correctly or something.

I'm also seeing this on the stable branch as well so I'm thinking this is on my side. Any advice would be appreciated!

— Reply to this email directly, view it on GitHub https://github.com/owebeeone/anchorscad/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACZQHMZ6QKV4KSTKJSUFO3ZS2CDTAVCNFSM6AAAAABM7GAQESVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ4DEMBTHE2TQOI . You are receiving this because you are subscribed to this thread.Message ID: @.***>