issue with max 2016

Hi

I am getting a
–FAILED to run the add_krakatoa.py script.

when i press export and render and nothing renders as well.

using max 2016 and vray 3.3

Thanks

Ok, first to explain what is being done in 2015/2016 vs. 2017:

The Krakatoa Beta build includes a Python script which is responsible for injecting the Krakatoa settings into the exported .vrscene file. However, we use two different approaches of executing this script depending on the Max version.

3ds Max 2015 and 2016 ship with a full Python 2.7 included in the C:\Program Files\Autodesk\3ds Max 201X\python\ folder. The MAXScript Python interface does not allow the loading and executing of Python functions in MAXScript, so we need to call python.exe with our script and the vrscene as argument from the command line.

3ds Max 2017 does not ship the whole Python 2.7, there isn’t even an exe in the C:\Program Files\Autodesk\3ds Max 2017\python\ folder. But it lets you define Python functions to be executed inside of MAXScript without running an external Python, so we use a completely different methods there.

I have been testing mainly with 2015 (which works the same as 2016 by running the script) and in 2017 (which uses the Python function approach), and have not seen any issues. So we have to figure out what is going wrong with your installation.

The relevant code does the following:

fn AddKrakatoaSettingsIntoVRScene vrscenePath jsonPath= ( local thePythonFile = getDir #maxroot + "python\\python.exe" local theCopyFile = getFileNamePath vrscenePath + "COPY_"+fileNameFromPath vrscenePath deleteFile theCopyFile local result = copyFile vrscenePath theCopyFile if result do ( if (maxVersion())[1] < 19000 then ( logMessage (">Adding Krakatoa Settings using Python Command Line call...") sysinfo.currentdir = getFileNamePath vrscenePath deleteFile (getFileNamePath vrscenePath+"add_krakatoa.py") local result2 = copyFile (FranticParticles.KrakatoaHome+"\\Scripts\\add_krakatoa.py") (getFileNamePath vrscenePath+"add_krakatoa.py") if result2 == false do logMessage ("--FAILED to copy add_krakatoa.py script to the output folder!") local result3 = doscommand ("\""+thePythonFile+"\" add_krakatoa.py "+ filenameFromPath theCopyFile +" "+ filenameFromPath jsonPath) if result3 != 0 do logMessage ("--FAILED to run the add_krakatoa.py script.") ) ...

  • So we define thePythonFile to be the Python.exe found in the 3ds Max installation.
  • Then we define a filename for the copy of the vrscene, and delete it if it exists.
  • We copy the scene file to the output folder. This obviously succeeds in your case, so it moves on to check the Max version. If it is less than 2017 (19000 in the internal version number), it goes to add the Krakatoa settings using a command line call.
  • It sets the current directory to the output path where the vrscene was copied to.
  • It deletes the old version of the add_krakatoa.py if it already exists and copies the script from the Krakatoa installation’s \Scripts folder into the output folder. This seems to work for you, too, otherwise you would be getting the error message “–FAILED to copy add_krakatoa.py script to the output folder!” Do you see that message by any chance?
  • Finally it calls doscommand with the python.exe path, the filename of the script, the vrscene name, and the krakatoa settings JSON file. This is what throws the error “–FAILED to run the add_krakatoa.py script.” if the return result of the doscommand is not 0.

So the first thing to check is whether there is a “–FAILED to copy add_krakatoa.py script to the output folder!” message before the “–FAILED to run the add_krakatoa.py script.” Open the output folder (click on the Version button and select “EXPLORE Current Version Folder […]”. See if it contains the following files:

add_krakatoa.py --> this should be copied over from the \Scripts folder of Krakatoa
YourProjectName.vscene --> this should have been exported by V-Ray from 3ds Max
YourProjectName.json --> this should have been exported by the Krakatoa VRY dialog
COPY_YourProjectName.vrscene --> this would only be created if the Python call succeeded.

I would expect the last file to be missing. If any of the others are missing, please let me know.

Also, check that python.exe is found in C:\Program Files\Autodesk\3ds Max 2016\python. I would not be surprised if some 3ds Max Product Update switched it to use the 2017 approach and removed the full Python support. If that is the case, I would have to add more checks and use the alternative 2017 method for running the script…

Actually, let’s start with confirming your exact 3ds Max 2016 version, including any Extensions installed. Look in the About 3ds Max dialog. You could also run in the MAXScript Listener

maxVersion()
and let me know the output.

I am installing 2016 SP3 right now to test…

That was the only message I was getting.

I have these files

add_krakatoa.py --> this should be copied over from the \Scripts folder of Krakatoa
YourProjectName.json --> this should have been exported by the Krakatoa VRY dialog
COPY_YourProjectName.vrscene --> this would only be created if the Python call succeeded.

but not this file
YourProjectName.vscene --> this should have been exported by V-Ray from 3ds Max
max version
#(18000, 46, 0)

is there an error msg if it fails to get vray standalone working?

This is strange. Btw, I installed 2016 SP3 and it is still working for me.

The export of the .vrscene is performed by VRay RT which must be set as the ActiveShade renderer. If you don’t have VRay RT installed, VRay won’t be able to export a .vrscene for VRay.exe to render.

Can you confirm you do have VRay RT installed correctly?

Can you zip up and attach the files from the export folder (minus the subfolders)?

Hi

My Vray RT is working fine . I have attached the files.

On a side note does this mean its limited by the limitations of VRAY RT?
exports.zip (26.1 KB)

No, it is rendering using VRay Stand-alone. But the MAXScript function for exporting .vrscene files from Max scenes depends on VRay RT. This peculiarity might change as Chaos Group is moving to make VRay more GPU-aware and possibly phase out VRay RT in the future, but that’s for Vlado or Lele to answer (both have access to this forum).

See the NOTES on this page:
docs.chaosgroup.com/display/VRA … TFunctions

Ok, this was quite the challenge. Good thing I wrote most of the MAXScript Documentation in the past 12 years (but that is over now).

It appears that your 3ds Max is set to save UTF8 with BOM, producing ASCII text files that confuse the heck out of Python.
I will provide the steps that it took to figure this out later in this post, but right now, I would be interested in knowing what your settings in this dialog are:


This was taken from the following page:
help.autodesk.com/view/3DSMAX/20 … 8E89F5_htm

If the option “Save strings in legacy non-scene files as UTF8” is checked, then the .json file will contain additional leading bytes (normally not seen in text editors) which define the Byte Order. The default is unchecked, which produces regular ASCII files that would work with Python in our case. I tested checking the option, and got the same issue as you reported. Unchecked it, and it solved the problem.

Of course, we cannot ask people to switch their preferences (which would prevent them from using foreign language characters in their files). So instead, the fix is to force UTF8 without BOM in the exporter script itself to ensure Python can parse the ASCII text. The fixed script is attached.
KrakatoaVRY_Exporter_UTF8Fix.zip (33.5 KB)

How did I find this (the long version for TDs and TAs):

  • I extracted the files you sent to a folder on Z drive.
  • I tried running the command line that the exporter would run, and got the actual Python error:

Z:\DATA\ForumHelp\Pieforme KVRY>"C:\Program Files\Autodesk\3ds Max 2016\python\python.exe" add_krakatoa.py krak3_test.0000.vrscene krak3_test.0000.json Traceback (most recent call last): File "add_krakatoa.py", line 144, in <module> modify_vrscene( scene_filename_arg, settings_filename_arg ) File "add_krakatoa.py", line 96, in modify_vrscene settings = json.load( settings_file ) File "C:\Program Files\Autodesk\3ds Max 2016\python\lib\json\__init__.py", line 278, in load **kw) File "C:\Program Files\Autodesk\3ds Max 2016\python\lib\json\__init__.py", line 326, in loads return _default_decoder.decode(s) File "C:\Program Files\Autodesk\3ds Max 2016\python\lib\json\decoder.py", line 366, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Program Files\Autodesk\3ds Max 2016\python\lib\json\decoder.py", line 384, in raw_decode raise ValueError("No JSON object could be decoded") ValueError: No JSON object could be decoded

  • Now I copied a known good .json file I had exported before into the same folder, replaced the name in the command line call, and it worked without a problem!
  • I renamed your file to the same name as my file (deleting mine first), and it still failed, so it was not the file name in any way.
  • I COPIED the content of your file into my file, and it worked, proving that the actual parameters exported by the script were valid ( I also compared it line by line with mine, and it was pretty much identical except for the file paths).
  • I opened your file in the MAXScript Editor, and opened the Save As dialog to resave the file - the file dialog showed the UTF format drop-down list at “UTF8 with BOM”. I switched it to “UTF8”, overwrote the file, and it started working!
  • I opened the MAXScript Customize>Preferences>File tab dialog and checked the “Save strings in legacy non-scene files as UTF8” option. Exported one of my scenes, and it failed. Unchecked the option, tried again, it worked.
  • I added the optional keyword arguments encoding:#utf8 writeBOM:false to all createFile() calls. Enabled the checkbox in preferences which broke the export previously, exported, it rendered correctly!

Thanks for reporting this, it would have been bad to start a public Beta without this under control! :blush:

YES! its working now. You had to dig deep for that.

“Save strings in legacy non-scene files as UTF8” was checked on. I do this because it is part of the requirements to submit files to Rebus renderfarm.