zeffii / mesh_tiny_cad

a tiny set of unmissable CAD functions ( VTX, XALL ...) for Blender

Home Page:http://zeffii.github.io/mesh_tiny_cad/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Import error Error with latest zip

Aiena-g opened this issue · comments

Traceback (most recent call last):
File "C:\Program Files\Blender Foundation\Blender\2.76\scripts\modules\addon_utils.py", line 324, in enable
mod = import(module_name)
File "C:\Users\Arvind P\AppData\Roaming\Blender Foundation\Blender\2.76\scripts\addons\mesh_tinyCAD__init__.py", line 55, in
from .VTX import TCAutoVTX
ImportError: cannot import name 'TCAutoVTX'


I cannot enable the addon with the latest zip because it spits out this error. I looked at the VTX.py (in the blender scripts install folder) and that class is defined.

Wonder why that error is happening. What I did.

  1. I downloaded the master zip from https://github.com/zeffii/Blender_CAD_utils/archive/master.zip (pressing the "Download zip" button on top right of the GitHub src page)
  2. I extracted it and rezipped the mesh_tinyCAD folder alone
  3. I installed the mesh_tinyCAD.zip in blender - addon shows up
  4. Error shows up on attempting to enable addon

System info:

Blender version: (2.76b)
OS: Windows 10

Its seems to import the stuff from CFG.py corrrectly and fails after that

Oh I am so sorry. Didn't realise the installable zip link and the zip from Github had different src's.

So sorry for the inconvenience closing this issue.

When I started this repo / add-on GitHub still allowed us to upload our own zips. Now a few years later that feature was removed and replaced by an automated .zip generator. Sadly this zip name will always contain a -master (or -some_branch_name) postfix, which is fine for single add-ons but it doesn't let me easily import code accross other add-ons. For example

- mesh_tinyCAD
  + __init__.py
  + cad_module.py
  + VTX.py / etc...


- mesh_tinyCAD_EXM
  + __init__.py

if I wanted to import helper code from a directory called mesh_tinyCAD it would write in mesh_tinyCAD_EXM / __init__.py, the following as import statement

 from mesh_tinyCAD import cad_module as cm

This would let me reuse the cad_module code quite conveniently.

A problem occurs if someone installs mesh_tinyCAD using the master zip, then their folder is called mesh_tinyCAD-master . And a line like this will throw an error, because python module names can't have - characters. It's an arithmetic operator minus too.

 from mesh_tinyCAD-master import cad_module as cm

That doesn't mean it's impossible to import files from a master zip, but it is a royal pain to have to include extra code.