Page MenuHome

Notify the user when blender tries to load a module directory with a '.' in it
AbandonedPublic

Authored by Rune Morling (ermo) on Oct 28 2019, 2:03 PM.

Details

Summary

I'm developing an add-on for Blender and am using git tags on github to tag and create releases.

When doing releases like this, it is not uncommon to use a git tag like 'v.1.1.2'.

Current behaviour:

Drop illegally named module-directories silently.

Expected behaviour:

Report that module directories containing periods like 'My-awesome-addon-v1.1' can't be loaded by python, thus following the principle of least surprise.

Diff Detail

Repository
rB Blender

Event Timeline

Rune Morling (ermo) edited the summary of this revision. (Show Details)

@LazyDodo (LazyDodo) suggested in blender.chat#blender-developers that I ping @Campbell Barton (campbellbarton) for this, seeing as he's apparently the last person to touch this code.

We even have a task for this T65360 (shame on me not chasing this further), so I wouldnt mind having this in....

Just for the record, i suggested to ask @Campbell Barton (campbellbarton) , not : post a patch with confrontational language and see if you get a reaction from the devs.

language should be tweaked, yes

Campbell Barton (campbellbarton) abandoned this revision.EditedOct 28 2019, 4:19 PM

Committed a different change, since this will still fail silently if you don't have a terminal open.

rB9267e6275cc9: PyAPI: change behavior of bpy.path.module_names

This check has been removed, now the add-on will raise an error when you try and enable it since the path name isn't valid.

It's up to add-on authors to use valid names, now they have some feedback on why an add-on wont load.

Just for the record, i suggested to ask @Campbell Barton (campbellbarton) , not : post a patch with confrontational language and see if you get a reaction from the devs.

I'm new to Blender development and I'm curious which part of this was considered 'confrontational language'? I certainly didn't intend it to be. Guidance welcome.

the Cowardly refusing to load bit is a little on the nose.

Committed a different change, since this will still fail silently if you don't have a terminal open.
rB9267e6275cc9: PyAPI: change behavior of bpy.path.module_names
This check has been removed, now the add-on will raise an error when you try and enable it since the path name isn't valid.
It's up to add-on authors to use valid names, now they have some feedback on why an add-on wont load.

That indeed sounds like a better solution than what I proposed. Thank you!

Rune Morling (ermo) added a comment.EditedOct 28 2019, 6:55 PM

the Cowardly refusing to load bit is a little on the nose.

Noted.

FWIW, it was only meant as a lighthearted reference to GNU Tar:

$ tar -cf foo.tar
tar: Cowardly refusing to create an empty archive
Try 'tar --help' or 'tar --usage' for more information.

But as I said, noted.