Error when scanning with new morph data system

Issue #1116 resolved
Buddyspencer13 created an issue

Hi, Thomas, first of all as always, thank you immensely as you keep improving the Addon and adding features that improve everything in general.

Reading your blog these days, and seeing the latest news you posted, I decided to update the addon to test the new feature you added.

I tried with the GM8 and GF8.1 models, both scans seem to work correctly, without error and it seems that the Json files were created in the output of the "scanned" folder.

But when adding the basic GF8 model, it gave error several times, and this is what Blender shows;

Python: Traceback (most recent call last):

File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\Diffeomorphic-import_daz-9b0cbe21d0a7\error.py", line 207, in execute
self.run(context)

File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\Diffeomorphic-import_daz-9b0cbe21d0a7\scan.py", line 129, in run

self.scanCharacter(context, name, relpath, scanpath)

File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\Diffeomorphic-import_daz-9b0cbe21d0a7\scan.py", line 154, in scanCharacter

self.scanMorphs(morphpath, len(morphpath))

File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\Diffeomorphic-import_daz-9b0cbe21d0a7\scan.py", line 186, in scanMorphs

self.scanMorphs(path, nskip)

File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\Diffeomorphic-import_daz-9b0cbe21d0a7\scan.py", line 186, in scanMorphs

self.scanMorphs(path, nskip)

File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\Diffeomorphic-import_daz-9b0cbe21d0a7\scan.py", line 192, in scanMorphs

self.scanMorph(path, nskip)

File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\Diffeomorphic-import_daz-9b0cbe21d0a7\scan.py", line 202, in scanMorph

struct = loadJson(path, silent=True)

File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\Diffeomorphic-import_daz-9b0cbe21d0a7\load_json.py", line 94, in loadJson

string = smashString(string, jsonerr)

File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\Diffeomorphic-import_daz-9b0cbe21d0a7\load_json.py", line 58, in smashString
while string[n].isspace() and n > 0:
IndexError: string index out of range

Another thing to mention, is that if every time you update the addon, when a new installation is created in the Blender scripts folder, the scans are somehow lost? copying them manually should not be a problem, right?

Best regards, thank you for your time.

Comments (5)

  1. Thomas Larsson repo owner

    The daz (.duf, .dsf) files are json files, optionally gzipped. To load them the plugin uses python's built-in gzip and json libraries. Unfortunately, it seems that DS has a more liberal view on json syntax than python has, and occasionally a daz file cannot be loaded in python, even though DS accepts this. Previously I have encountered one such discrepancy, where the daz file had one extra comma. In that case the plugin avoids the problem by replacing the extra comma with a space.

    However, it seems like the syntax in your file is illegal in some other way, and the plugin wasn’t ready for that. Now I have tried to make sure that this doesn’t cause an error, but that the illegal file is simply ignored. I’m not 100% that it will work out that way though, since I haven’t had a test case.

    As for updating, the format of the scanned database was changed recently. If you try to utilise an obsolete scanned file there will be a error telling you to rescan the database. But this is only because scanning is so new. Once the format has settled, which I think it already has perhaps, it will not be necessary to rescan the database due to plugin updates. But you need to do it if you add new morphs to DS.

    Since I use git myself I didn’t realize that updates would overwrite the database files. That’s not good. In the last commit the location of the database files is determined by a global setting, which defaults to "~/Documents/Scanned DAZ Database". Since it is located outside the plugin it is not overwritten by updates.

  2. Buddyspencer13 reporter

    Thanks for taking a look at it, and looking at it, and adding that new folder function set for scans.

    I have tried with your last version you added, and I get almost the same error again, adding two new lines at the end ; line 97, line 61.

    Lines 94, 58, were not displayed.

    Python: Traceback (most recent call last):
    File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\Diffeomorphic-import_daz-aa2c2ee28dbf\error.py", line 207, in execute
    self.run(context)

    File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\Diffeomorphic-import_daz-aa2c2ee28dbf\scan.py", line 129, in run
    self.scanCharacter(context, name, relpath, scanpath)

    File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\Diffeomorphic-import_daz-aa2c2ee28dbf\scan.py", line 154, in scanCharacter
    self.scanMorphs(morphpath, len(morphpath))

    File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\Diffeomorphic-import_daz-aa2c2ee28dbf\scan.py", line 186, in scanMorphs

    self.scanMorphs(path, nskip)
    

    File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\Diffeomorphic-import_daz-aa2c2ee28dbf\scan.py", line 186, in scanMorphs

    self.scanMorphs(path, nskip)
    

    File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\Diffeomorphic-import_daz-aa2c2ee28dbf\scan.py", line 192, in scanMorphs

    self.scanMorph(path, nskip)
    

    File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\Diffeomorphic-import_daz-aa2c2ee28dbf\scan.py", line 202, in scanMorph

    struct = loadJson(path, silent=True)
    

    File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\Diffeomorphic-import_daz-aa2c2ee28dbf\load_json.py", line 97, in loadJson

    string = smashString(string, jsonerr)
    

    File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\Diffeomorphic-import_daz-aa2c2ee28dbf\load_json.py", line 61, in smashString
    while string[n].isspace() and n > 0:
    IndexError: string index out of range

  3. Thomas Larsson repo owner

    It is difficult to tell without looking at the file. Could you upload the file that causes the problems. An abbreviated file path is printed in the terminal before it is loaded, so the bad guy is the last file in the list. To get the full file path, add one of the root directories + the path where the characters morphs are stored in front of the abbreviated path.

    E.g., all G3F morphs are stored under

    \data\DAZ 3D\Genesis 3\Female\Morphs
    

    If the output in the terminal is

    * \DAZ 3D\Base Correctives\pJCMMid1Dwn_95_R.dsf
    

    then the complete file path is

    <Root dir>\data\DAZ 3D\Genesis 3\Female\Morphs\DAZ 3D\Base Correctives\pJCMMid1Dwn_95_R.dsf
    

    PS. You can use the code snippet gadget to add multiline formatted text.

  4. Buddyspencer13 reporter

    Thomas, I think I was able to find the problem and solve it after doing several tests, it turns out that it was a specific file or folder that gave the problem, I did several scans cleaning and separating morph folders, until I found the folder that gave the error, it seems that inside this folder there were not only default dsf files, but also a compressed file in .7z format, which was causing all this problem when scanning.

    I didn't do the specific test with that specific file by itself, but I noticed that only that whole folder was giving an error when scanning, I removed the folder and was able to scan all the other many folders I had, there were quite a lot of them.

    Many thanks for the help provided.

  5. Log in to comment