Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-05-06 01:51:54 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-05-06 01:51:54 +0400
commit4bc6749403f0b59c53637b60f936ddc8e0a66d10 (patch)
tree5d17263a7a05997214f25fa35163b76614829520
parent2bce9ff1d10a54deffbf0937d5c48b5982f07f2f (diff)
[#18695] Replace python errors with useful messages when no full python installation is found
from Philipp Oeser (lichtwerk)
-rw-r--r--release/scripts/3ds_export.py12
-rw-r--r--release/scripts/DirectX8Exporter.py3
-rw-r--r--release/scripts/add_mesh_torus.py8
-rw-r--r--release/scripts/export_dxf.py62
-rw-r--r--release/scripts/export_fbx.py19
-rw-r--r--release/scripts/help_bpy_api.py12
-rw-r--r--release/scripts/help_getting_started.py12
-rw-r--r--release/scripts/help_manual.py12
-rw-r--r--release/scripts/help_release_notes.py10
-rw-r--r--release/scripts/help_tutorials.py10
-rw-r--r--release/scripts/help_web_blender.py10
-rw-r--r--release/scripts/help_web_devcomm.py10
-rw-r--r--release/scripts/help_web_eshop.py10
-rw-r--r--release/scripts/help_web_usercomm.py10
-rw-r--r--release/scripts/lightwave_export.py12
15 files changed, 147 insertions, 65 deletions
diff --git a/release/scripts/3ds_export.py b/release/scripts/3ds_export.py
index 54e1ea3db33..87680bce1b0 100644
--- a/release/scripts/3ds_export.py
+++ b/release/scripts/3ds_export.py
@@ -7,7 +7,7 @@ Group: 'Export'
Tooltip: 'Export to 3DS file format (.3ds).'
"""
-__author__ = ["Campbell Barton", "Bob Holcomb", "Richard Lärkäng", "Damien McGinnes", "Mark Stijnman"]
+__author__ = ["Campbell Barton", "Bob Holcomb", "Richard Lärkäng", "Damien McGinnes", "Mark Stijnman"]
__url__ = ("blenderartists.org", "www.blender.org", "www.gametutorials.com", "lib3ds.sourceforge.net/")
__version__ = "0.90a"
__bpydoc__ = """\
@@ -50,7 +50,10 @@ import Blender
import bpy
from BPyMesh import getMeshFromObject
from BPyObject import getDerivedObjects
-import struct
+try:
+ import struct
+except:
+ struct = None
# So 3ds max can open files, limit names to 12 in length
# this is verry annoying for filenames!
@@ -1009,5 +1012,8 @@ def save_3ds(filename):
if __name__=='__main__':
- Blender.Window.FileSelector(save_3ds, "Export 3DS", Blender.sys.makename(ext='.3ds'))
+ if struct:
+ Blender.Window.FileSelector(save_3ds, "Export 3DS", Blender.sys.makename(ext='.3ds'))
+ else:
+ Blender.Draw.PupMenu("Error%t|This script requires a full python installation")
# save_3ds('/test_b.3ds')
diff --git a/release/scripts/DirectX8Exporter.py b/release/scripts/DirectX8Exporter.py
index b8bdae4de2b..8a0ecaf0eb7 100644
--- a/release/scripts/DirectX8Exporter.py
+++ b/release/scripts/DirectX8Exporter.py
@@ -45,7 +45,8 @@ from Blender import Types, Object, NMesh, Material,Armature,Mesh
from Blender.Mathutils import *
from Blender import Draw, BGL
from Blender.BGL import *
-import math
+try: import math
+except: math = None
global mat_flip,index_list,space,bone_list,mat_dict
global anim,flip_norm,swap_zy,flip_z,speed,ticks,no_light,recalc_norm,Bl_norm
diff --git a/release/scripts/add_mesh_torus.py b/release/scripts/add_mesh_torus.py
index 4f759256497..f2fc53ef275 100644
--- a/release/scripts/add_mesh_torus.py
+++ b/release/scripts/add_mesh_torus.py
@@ -6,7 +6,8 @@ Group: 'AddMesh'
"""
import BPyAddMesh
import Blender
-from math import cos, sin, pi
+try: from math import cos, sin, pi
+except: math = None
def add_torus(PREF_MAJOR_RAD, PREF_MINOR_RAD, PREF_MAJOR_SEG, PREF_MINOR_SEG):
Vector = Blender.Mathutils.Vector
@@ -61,5 +62,8 @@ def main():
BPyAddMesh.add_mesh_simple('Torus', verts, [], faces)
-main()
+if math:
+ main()
+else:
+ Blender.Draw.PupMenu("Error%t|This script requires a full python installation")
diff --git a/release/scripts/export_dxf.py b/release/scripts/export_dxf.py
index 99c6acaceab..84a173c1e7d 100644
--- a/release/scripts/export_dxf.py
+++ b/release/scripts/export_dxf.py
@@ -94,37 +94,40 @@ ______________________________________________________________
import Blender
from Blender import Mathutils, Window, Scene, sys, Draw, Mesh
import BPyMessages
-import os
-import subprocess
+try: import os
+except: os = None
+try: import subprocess
+except: subprocess = None
+try: import copy
+except: copy = None
#print os.sys.platform
#print dir(os.sys.version)
#import dxfLibrary
#reload(dxfLibrary)
-from dxfLibrary import *
-
-
-#-------- DWG support ------------------------------------------
-extCONV_OK = True
-extCONV = 'DConvertCon.exe'
-extCONV_PATH = os.path.join(Blender.Get('scriptsdir'),extCONV)
-if not os.path.isfile(extCONV_PATH):
- extCONV_OK = False
- extCONV_TEXT = 'DWG-Exporter: Abort, nothing done!|\
-Copy first %s into Blender script directory.|\
-More details in online Help.' %extCONV
-else:
- if not os.sys.platform.startswith('win'):
- # check if Wine installed:
- if subprocess.Popen(('which', 'winepath'), stdout=subprocess.PIPE).stdout.read().strip():
- extCONV_PATH = 'wine %s'%extCONV_PATH
- else:
- extCONV_OK = False
- extCONV_TEXT = 'DWG-Exporter: Abort, nothing done!|\
-The external DWG-converter (%s) needs Wine installed on your system.|\
-More details in online Help.' %extCONV
-#print 'extCONV_PATH = ', extCONV_PATH
+if copy and os:
+ from dxfLibrary import *
+ #-------- DWG support ------------------------------------------
+ extCONV_OK = True
+ extCONV = 'DConvertCon.exe'
+ extCONV_PATH = os.path.join(Blender.Get('scriptsdir'),extCONV)
+ if not os.path.isfile(extCONV_PATH):
+ extCONV_OK = False
+ extCONV_TEXT = 'DWG-Exporter: Abort, nothing done!|\
+ Copy first %s into Blender script directory.|\
+ More details in online Help.' %extCONV
+ else:
+ if not os.sys.platform.startswith('win'):
+ # check if Wine installed:
+ if subprocess.Popen(('which', 'winepath'), stdout=subprocess.PIPE).stdout.read().strip():
+ extCONV_PATH = 'wine %s'%extCONV_PATH
+ else:
+ extCONV_OK = False
+ extCONV_TEXT = 'DWG-Exporter: Abort, nothing done!|\
+ The external DWG-converter (%s) needs Wine installed on your system.|\
+ More details in online Help.' %extCONV
+ #print 'extCONV_PATH = ', extCONV_PATH
@@ -526,7 +529,8 @@ http://wiki.blender.org/index.php?title=Scripts/Manual/Export/autodesk_dxf')
#-----------------------------------------------------
if __name__=='__main__':
- #main()
- if not copy:
- Draw.PupMenu('Error%t|This script requires a full python install')
- else: Window.FileSelector(dxf_export_ui, 'EXPORT DXF', sys.makename(ext='.dxf')) \ No newline at end of file
+ #main()
+ if copy and os and subprocess:
+ Window.FileSelector(dxf_export_ui, 'EXPORT DXF', sys.makename(ext='.dxf'))
+ else:
+ Draw.PupMenu('Error%t|This script requires a full python install')
diff --git a/release/scripts/export_fbx.py b/release/scripts/export_fbx.py
index 80b2fea0dd8..65427dcfee6 100644
--- a/release/scripts/export_fbx.py
+++ b/release/scripts/export_fbx.py
@@ -2729,15 +2729,16 @@ def fbx_ui_exit(e,v):
GLOBALS['EVENT'] = e
def do_help(e,v):
- url = 'http://wiki.blender.org/index.php/Scripts/Manual/Export/autodesk_fbx'
- print 'Trying to open web browser with documentation at this address...'
- print '\t' + url
-
- try:
- import webbrowser
- webbrowser.open(url)
- except:
- print '...could not open a browser window.'
+ url = 'http://wiki.blender.org/index.php/Scripts/Manual/Export/autodesk_fbx'
+ print 'Trying to open web browser with documentation at this address...'
+ print '\t' + url
+
+ try:
+ import webbrowser
+ webbrowser.open(url)
+ except:
+ Blender.Draw.PupMenu("Error%t|Opening a webbrowser requires a full python installation")
+ print '...could not open a browser window.'
diff --git a/release/scripts/help_bpy_api.py b/release/scripts/help_bpy_api.py
index 9c3a24af288..e8d77ed8452 100644
--- a/release/scripts/help_bpy_api.py
+++ b/release/scripts/help_bpy_api.py
@@ -36,6 +36,12 @@ This script opens the user's default web browser at http://www.blender.org's
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
-import Blender, webbrowser
-version = str(int(Blender.Get('version')))
-webbrowser.open('http://www.blender.org/documentation/'+ version +'PythonDoc/')
+import Blender
+try: import webbrowser
+except: webbrowser = None
+
+if webbrowser:
+ version = str(int(Blender.Get('version')))
+ webbrowser.open('http://www.blender.org/documentation/'+ version +'PythonDoc/')
+else:
+ Blender.Draw.PupMenu("Error%t|This script requires a full python installation")
diff --git a/release/scripts/help_getting_started.py b/release/scripts/help_getting_started.py
index a4f6da5cc55..77dda2cf88f 100644
--- a/release/scripts/help_getting_started.py
+++ b/release/scripts/help_getting_started.py
@@ -38,5 +38,13 @@ This script opens the user's default web browser at www.blender.org's
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
-import Blender, webbrowser
-webbrowser.open('http://www.blender.org/education-help/tutorials/getting-started/')
+import Blender
+try: import webbrowser
+except: webbrowser = None
+
+if webbrowser:
+ webbrowser.open('http://www.blender.org/education-help/tutorials/getting-started/')
+else:
+ Blender.Draw.PupMenu("Error%t|This script requires a full python installation")
+
+
diff --git a/release/scripts/help_manual.py b/release/scripts/help_manual.py
index b830975e593..27900040eb4 100644
--- a/release/scripts/help_manual.py
+++ b/release/scripts/help_manual.py
@@ -36,5 +36,13 @@ This script opens the user's default web browser at www.blender.org's
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
-import Blender, webbrowser
-webbrowser.open('http://wiki.blender.org/index.php/Manual')
+import Blender
+try: import webbrowser
+except: webbrowser = None
+
+if webbrowser:
+ webbrowser.open('http://wiki.blender.org/index.php/Manual')
+else:
+ Blender.Draw.PupMenu("Error%t|This script requires a full python installation")
+
+
diff --git a/release/scripts/help_release_notes.py b/release/scripts/help_release_notes.py
index 919ec72da3c..870f2391487 100644
--- a/release/scripts/help_release_notes.py
+++ b/release/scripts/help_release_notes.py
@@ -36,6 +36,12 @@ This script opens the user's default web browser at www.blender.org's
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
-import Blender, webbrowser
+import Blender
+try: import webbrowser
+except: webbrowser = None
+
+if webbrowser:
+ webbrowser.open('http://www.blender.org/development/release-logs/')
+else:
+ Blender.Draw.PupMenu("Error%t|This script requires a full python installation")
-webbrowser.open('http://www.blender.org/development/release-logs/')
diff --git a/release/scripts/help_tutorials.py b/release/scripts/help_tutorials.py
index 1fe466560f0..e0cef1abdbf 100644
--- a/release/scripts/help_tutorials.py
+++ b/release/scripts/help_tutorials.py
@@ -37,5 +37,11 @@ This script opens the user's default web browser at www.blender.org's
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
-import Blender, webbrowser
-webbrowser.open('http://www.blender.org/education-help/tutorials/')
+import Blender
+try: import webbrowser
+except: webbrowser = None
+
+if webbrowser:
+ webbrowser.open('http://www.blender.org/education-help/tutorials/')
+else:
+ Blender.Draw.PupMenu("Error%t|This script requires a full python installation")
diff --git a/release/scripts/help_web_blender.py b/release/scripts/help_web_blender.py
index db0a78d90f7..2a0f90844ae 100644
--- a/release/scripts/help_web_blender.py
+++ b/release/scripts/help_web_blender.py
@@ -38,5 +38,11 @@ www.blender.org.
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
-import Blender, webbrowser
-webbrowser.open('http://www.blender.org/')
+import Blender
+try: import webbrowser
+except: webbrowser = None
+
+if webbrowser:
+ webbrowser.open('http://www.blender.org/')
+else:
+ Blender.Draw.PupMenu("Error%t|This script requires a full python installation")
diff --git a/release/scripts/help_web_devcomm.py b/release/scripts/help_web_devcomm.py
index e04a54501f7..46fa2487a89 100644
--- a/release/scripts/help_web_devcomm.py
+++ b/release/scripts/help_web_devcomm.py
@@ -37,5 +37,11 @@ This script opens the user's default web browser at www.blender.org's
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
-import webbrowser
-webbrowser.open('http://www.blender.org/community/get-involved/')
+import Blender
+try: import webbrowser
+except: webbrowser = None
+
+if webbrowser:
+ webbrowser.open('http://www.blender.org/community/get-involved/')
+else:
+ Blender.Draw.PupMenu("Error%t|This script requires a full python installation")
diff --git a/release/scripts/help_web_eshop.py b/release/scripts/help_web_eshop.py
index c33849ac419..e40795b3a0d 100644
--- a/release/scripts/help_web_eshop.py
+++ b/release/scripts/help_web_eshop.py
@@ -37,5 +37,11 @@ This script opens the user's default web browser at www.blender.org's
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
-import Blender, webbrowser
-webbrowser.open('http://www.blender3d.org/e-shop')
+import Blender
+try: import webbrowser
+except: webbrowser = None
+
+if webbrowser:
+ webbrowser.open('http://www.blender3d.org/e-shop')
+else:
+ Blender.Draw.PupMenu("Error%t|This script requires a full python installation")
diff --git a/release/scripts/help_web_usercomm.py b/release/scripts/help_web_usercomm.py
index a77a2bb9fef..dda5e42f34e 100644
--- a/release/scripts/help_web_usercomm.py
+++ b/release/scripts/help_web_usercomm.py
@@ -37,5 +37,11 @@ This script opens the user's default web browser at www.blender.org's
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
-import webbrowser
-webbrowser.open('http://www.blender.org/community/user-community/')
+import Blender
+try: import webbrowser
+except: webbrowser = None
+
+if webbrowser:
+ webbrowser.open('http://www.blender.org/community/user-community/')
+else:
+ Blender.Draw.PupMenu("Error%t|This script requires a full python installation")
diff --git a/release/scripts/lightwave_export.py b/release/scripts/lightwave_export.py
index 115761ec3e0..bbfb9649c69 100644
--- a/release/scripts/lightwave_export.py
+++ b/release/scripts/lightwave_export.py
@@ -68,8 +68,13 @@ v5.5 format.
# ***** END GPL LICENCE BLOCK *****
import Blender
-import struct, cStringIO, operator
import BPyMesh
+try: import struct
+except: struct = None
+try: import cStringIO
+except: cStringIO = None
+try: import operator
+except: operator = None
VCOL_NAME = "\251 Per-Face Vertex Colors"
DEFAULT_NAME = "\251 Blender Default"
@@ -696,4 +701,7 @@ def fs_callback(filename):
if not filename.lower().endswith('.lwo'): filename += '.lwo'
write(filename)
-Blender.Window.FileSelector(fs_callback, "Export LWO", Blender.sys.makename(ext='.lwo'))
+if struct and cStringIO and operator:
+ Blender.Window.FileSelector(fs_callback, "Export LWO", Blender.sys.makename(ext='.lwo'))
+else:
+ Blender.Draw.PupMenu("Error%t|This script requires a full python installation")