Avoid modification of python system paths

This isn't a proper way to solve the import problem, use relative import instead.
This commit is contained in:
Sergey Sharybin 2016-08-03 13:36:22 +02:00
parent 1b9a94b5f9
commit 606fbde1c3
19 changed files with 34 additions and 58 deletions

View File

@ -39,18 +39,6 @@ bl_info = {
import sys
import os
# ----------------------------------------------
# Add to Phyton path (once only)
# ----------------------------------------------
path = sys.path
flag = False
for item in path:
if "archimesh" in item:
flag = True
if flag is False:
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'archimesh'))
print("archimesh: added to phytonpath")
# ----------------------------------------------
# Import modules
# ----------------------------------------------
@ -72,20 +60,20 @@ if "bpy" in locals():
imp.reload(achm_window_panel)
print("archimesh: Reloaded multifiles")
else:
import achm_books_maker
import achm_column_maker
import achm_curtain_maker
import achm_venetian_maker
import achm_door_maker
import achm_kitchen_maker
import achm_lamp_maker
import achm_main_panel
import achm_roof_maker
import achm_room_maker
import achm_shelves_maker
import achm_stairs_maker
import achm_window_maker
import achm_window_panel
from . import achm_books_maker
from . import achm_column_maker
from . import achm_curtain_maker
from . import achm_venetian_maker
from . import achm_door_maker
from . import achm_kitchen_maker
from . import achm_lamp_maker
from . import achm_main_panel
from . import achm_roof_maker
from . import achm_room_maker
from . import achm_shelves_maker
from . import achm_stairs_maker
from . import achm_window_maker
from . import achm_window_panel
print("archimesh: Imported multifiles")

View File

@ -29,7 +29,7 @@ import math
import random
import copy
import colorsys
from achm_tools import *
from .achm_tools import *
# ------------------------------------------------------------------

View File

@ -26,7 +26,7 @@
# noinspection PyUnresolvedReferences
import bpy
import math
from achm_tools import *
from .achm_tools import *
# ------------------------------------------------------------------

View File

@ -28,7 +28,7 @@ import bpy
import colorsys
import copy
import math
from achm_tools import *
from .achm_tools import *
# ------------------------------------------------------------------

View File

@ -27,7 +27,7 @@ import bpy
import math
# noinspection PyUnresolvedReferences
from bpy.props import *
from achm_tools import *
from .achm_tools import *
# ------------------------------------------------------------------

View File

@ -34,7 +34,7 @@ import math
import mathutils
# noinspection PyUnresolvedReferences
from bpy_extras import view3d_utils
from achm_room_maker import get_wall_points
from .achm_room_maker import get_wall_points
# -------------------------------------------------------------

View File

@ -29,7 +29,7 @@ import copy
import sys
import datetime
import time
from achm_tools import *
from .achm_tools import *
from bpy_extras.io_utils import ExportHelper
# ----------------------------------------------------------

View File

@ -26,7 +26,7 @@
import bpy
import math
import copy
from achm_tools import *
from .achm_tools import *
# ------------------------------------------------------

View File

@ -27,8 +27,8 @@
import bpy
# noinspection PyUnresolvedReferences
import bgl
from achm_tools import *
from achm_gltools import *
from .achm_tools import *
from .achm_gltools import *
# -----------------------------------------------------

View File

@ -26,7 +26,7 @@
# noinspection PyUnresolvedReferences
import bpy
import math
from achm_tools import *
from .achm_tools import *
# ------------------------------------------------------------------

View File

@ -30,7 +30,7 @@ import math
import mathutils
import datetime
import time
from achm_tools import *
from .achm_tools import *
# noinspection PyUnresolvedReferences
from bpy_extras.io_utils import ExportHelper, ImportHelper

View File

@ -25,7 +25,7 @@
# ----------------------------------------------------------
import bpy
import copy
from achm_tools import *
from .achm_tools import *
# ------------------------------------------------------------------

View File

@ -26,7 +26,7 @@
# noinspection PyUnresolvedReferences
import bpy
import math
from achm_tools import *
from .achm_tools import *
# ------------------------------------------------------------------

View File

@ -27,7 +27,7 @@ import bpy
import math
# noinspection PyUnresolvedReferences
from bpy.props import *
from achm_tools import *
from .achm_tools import *
# ------------------------------------------------------------------

View File

@ -27,7 +27,7 @@ import bpy
import math
# noinspection PyUnresolvedReferences
from bpy.props import *
from achm_tools import *
from .achm_tools import *
# ------------------------------------------------------------------

View File

@ -31,7 +31,7 @@ import bpy
import math
# noinspection PyUnresolvedReferences
import mathutils
from achm_tools import *
from .achm_tools import *
def fitil(vr, fc, px, pz, x, y, z, zz, xx):

View File

@ -39,18 +39,6 @@ bl_info = {
import sys
import os
# ----------------------------------------------
# Add to Phyton path (once only)
# ----------------------------------------------
path = sys.path
flag = False
for item in path:
if "measureit" in item:
flag = True
if flag is False:
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'measureit'))
print("measureit: added to phytonpath")
# ----------------------------------------------
# Import modules
# ----------------------------------------------
@ -60,7 +48,7 @@ if "bpy" in locals():
imp.reload(measureit_main)
print("measureit: Reloaded multifiles")
else:
import measureit_main
from . import measureit_main
print("measureit: Imported multifiles")

View File

@ -33,8 +33,8 @@ import bgl
# noinspection PyUnresolvedReferences
from bpy.app.handlers import persistent
# noinspection PyUnresolvedReferences
from measureit_geometry import *
from measureit_render import *
from .measureit_geometry import *
from .measureit_render import *
# ------------------------------------------------------

View File

@ -42,7 +42,7 @@ import bpy_extras.object_utils as object_utils
# noinspection PyUnresolvedReferences
from bpy_extras import view3d_utils
from math import ceil
from measureit_geometry import *
from .measureit_geometry import *
# -------------------------------------------------------------