AdrianLazar Posted July 6, 2014 Share Posted July 6, 2014 (edited) Hi guys, I'm having an issue using the fbximport command: if the fbx path contains spaces then houdini crashes, for example: hou.hscript('fbximport $HIP/test e/test2.fbx') -> crash hou.hscript('fbximport $HIP/test/test2.fbx') -> works fine At first I thought that houdini doesn't support spaces in paths but if I use the fileSop to read a geometry file with spaces in the path that work perfectly fine. Now I know there shouldn't be any spaces in folder names to begin with but that's something in this case I don't have any control over Any help would be much appreciated, Thanks! Edited July 6, 2014 by AdrianLazar Quote Link to comment Share on other sites More sharing options...
Mandrake0 Posted July 6, 2014 Share Posted July 6, 2014 i just tested in the textport and in Python shell you have to use for the Path =>" the error comes because the hscript thinks the the filepath has ended where the space is. to solve this you have to put the filepath in to double quotes. this should work: hou.hscript('fbximport "$HIP/test e/test2.fbx"') Quote Link to comment Share on other sites More sharing options...
AdrianLazar Posted July 7, 2014 Author Share Posted July 7, 2014 (edited) Hi Francis, Thanks for the quick reply, it worked fine in the test. Unfortunately for the real implementation doesn't work since I need to generate file path from a parameter like this: _objecttodestroy = HDA.parm('objecttodestroy').eval() fbxtoimport = 'fbximport -m off ' + _objecttodestroy hou.hscript(fbxtoimport) Thanks again, -Adrian Edited July 7, 2014 by AdrianLazar Quote Link to comment Share on other sites More sharing options...
pezetko Posted July 7, 2014 Share Posted July 7, 2014 (edited) Then this should work: _objecttodestroy = HDA.parm('objecttodestroy').eval() fbxtoimport = 'fbximport -m off "{}"'.format(_objecttodestroy) hou.hscript(fbxtoimport) Edited July 7, 2014 by pezetko Quote Link to comment Share on other sites More sharing options...
AdrianLazar Posted July 7, 2014 Author Share Posted July 7, 2014 Awesome, that works Petr! Could you explain me what is it doing to make it work? Thanks! Quote Link to comment Share on other sites More sharing options...
pezetko Posted July 7, 2014 Share Posted July 7, 2014 It replaces {} with variable in .format(variable) method.Because string is interpreted between single quotes ('some string') the double quotes inside that string are interpreted as part of the string ('some string "quoted" is still string') a = 1 b = 'other text' text = 'some text "{}" {}'.format(a, print text # for double quotes inside doube quotes we need escape character text = "some text \"{}\" {}".format(a, print text 1 Quote Link to comment Share on other sites More sharing options...
AdrianLazar Posted July 7, 2014 Author Share Posted July 7, 2014 Thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.