I wrote a simple script. It works. But if someone instalsl it, it breaks blender.

Below is a text copy of the code from the script that I saved to a file called QuickGameUV.py

In Blender, if you load this in the text editor, and press run, the script does what it’s supposed to.
Now I had not thought about installing it, and I sent that .py file inside of a .zip to a friend. He installed it and it broke his blender, he warned me, so I tried to install it and it broke my Blender too!

After going to add-ons > install from file > select the .zip
it throws an error: (this is a copy of the error after I tried installing it a few times so it might not be the same as the original error message)

Now once you close the error message, the add-ons screen is blank, you just have the buttons at the bottom. Refresh doesn’t do anything. You do see the usual list of add-ons/check boxes/search, just a blank screen and buttons at the bottom.

Here’s where it gets even crazier. I use blender portable, the .zip download (not the installer) so I though I would just extract a new copy of blender to the desktop for further testing. Well, I loaded that new copy of blender up and it is also broken…

At worst, if my code is bad or something is missing, etc…, Blender should refuse to install the script (not break). This is a serious problem. Please help. If a bug request submit is needed, I will not be able to do that until later tomorrow. In the mean time, I will wait for replies, my friend sholld be following this thread also, but I won’t be able to read new replies until later tomorrow.

Thank you in advance for the help. The code is copied below.

bl_info = {
    "name": "Quick Game UVs",
    "author": "Cancer > blenderartists.org",
    "version": (1, 0),
    "blender": (2, 76, 0),
    "license": "GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html",

import bpy

for obj in bpy.context.selected_objects:
    bpy.context.scene.objects.active = obj

    bpy.ops.object.modifier_apply(apply_as='DATA', modifier="EdgeSplit")
    bpy.ops.object.mode_set(mode = 'EDIT')
    bpy.ops.uv.unwrap(method='ANGLE_BASED', margin=0.003)
    bpy.ops.object.mode_set(mode = 'OBJECT')

do you want a button that runs this script?

add this to the end of the script

def register():

def unregister():
if __name__ == "__main__":

That is great albert, TY. BUT, why would my poorly written script that is missing the button code, break Blender’s add-on screen. Isn’t that a little severe/dangerous? Shouldn’t that, hopefully, not be possible, and just give an error instead?

Guessing from the error message, it appears to be looking for bl_info[“category”], but you didn’t provide this attribute.