diff --git a/doc/python_api/rst/info_best_practice.rst b/doc/python_api/rst/info_best_practice.rst index d191bb608e8..1f0f81f7d14 100644 --- a/doc/python_api/rst/info_best_practice.rst +++ b/doc/python_api/rst/info_best_practice.rst @@ -264,7 +264,7 @@ if your unsure whether the text is upper or lower case use lower or upper string Use try/except Sparingly ------------------------ -The **try** statement useful to save time writing error checking code. +The **try** statement is useful to save time writing error checking code. However **try** is significantly slower then an **if** since an exception has to be set each time, so avoid using **try** in areas of your code that execute in a loop and runs many times. diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index c66c215203d..7cfcfcf6085 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -14,7 +14,7 @@ # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # - # Contributor(s): Campbell Barton + # Contributor(s): Campbell Barton, Luca Bonavita # # #**** END GPL LICENSE BLOCK #**** @@ -77,12 +77,12 @@ import shutil from platform import platform PLATFORM = platform().split('-')[0].lower() # 'linux', 'darwin', 'windows' +SCRIPT_DIR = os.path.dirname(__file__) def handle_args(): ''' - Get the args passed to Blender after "--", ignored by Blender + Parse the args passed to Blender after "--", ignored by Blender ''' - import argparse # When --help is given, print the usage text @@ -91,81 +91,104 @@ def handle_args(): usage=SCRIPT_HELP_MSG ) + # optional arguments parser.add_argument("-o", "--output", dest="output_dir", type=str, - help="Path of the API docs (optional)", + default=SCRIPT_DIR, + help="Path of the API docs (default=