le717/Blender-2.6-LDraw-Importer — pull request #14 by Tribex (2013-11-06 06:04:49+00:00)
Title:  Update ldraw_import.py, Better Error Handling (Requires 9c9e15b because I forgot to make a branch)

Change 1:
------
All outputs to the console now use a debugPrint(STRING) function which is a wrapper for print('[LDraw Importer] '+STRING+' - '+CURRENT_TIME_IN_HOURS:MINUTES:SECONDS)

This makes it easier to determine what messages come from what addons and exactly when they happened.

**EXAMPLE 1:**

```
~$: [LDraw Importer] Attempting to import /home/USER/LDCad/plane.ldr - 11:08:46
```

Change 2:
------
Major error messages now display a small popup when called, notifying the user in Blender's UI, instead of silently closing the file select screen and only outputting to the console.

**EXAMPLE 2:**
![screenshot from 2013-11-06 14 00 06](https://f.cloud.github.com/assets/5861371/1480351/eaa8d522-46a8-11e3-84bf-7984cfae51f9.png)

Change 3:
------
Major Error messages now identify what type of error they were, and print the stack trace where necessary.

**EXAMPLE 3:**
```
~$:[LDraw Importer] ERROR: UnicodeDecodeError
Traceback (most recent call last):
File "ldraw_import.py", line 671, in create_model
LDrawFile(context, file_name, mat)
File "ldraw_import.py", line 71, in __init__
self.parse(filename)
File "ldraw_import.py", line 169, in parse
lines = f_in.readlines()
File "Software/Blender-2.69/2.69/python/lib/python3.3/codecs.py", line 300, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x90 in position 54: invalid start byte

- 11:01:18
[LDraw Importer] ERROR: File not imported. Reason: UnicodeDecodeError. - 11:01:18
```

Change 4:
------
Importing files which do not have a .ldr, .dat, or .mpd extension is no longer allowed and will not be attempted, and will tell the user through a popup in Blender's UI.

**EXAMPLE 4:**
```
[LDraw Importer] Attempting to import /home/USER/TestZipFle.zip - 11:06:53
[LDraw Importer] ERROR: File not imported. Reason: Invalid File Type (Must be a .dat, .ldr, or .mpd) - 11:06:53
```
![screenshot from 2013-11-06 13 59 23](https://f.cloud.github.com/assets/5861371/1480353/ee7b5d46-46a8-11e3-9fcb-e92e74a93d00.png)

This commit is also PEP8 Validated, except for some lines that are too long.
http://pep8online.com/s/OEEdEU2B