Or, if you're like me and don't ever remember how the %s formatting works: imagePath="{pth}icons/staircon.jpg".format(pth=mc.internalVar(userPrefDir=True))
or better yet, because it's a file path: import os imagePath= os.path.join(mc.internalVar(userPrefDir=True), 'icons', 'staircon.jpg') That last one is often best, because it will handle os specific things like whether directories are split by '/' or by '\'. On Monday, August 10, 2015 at 3:49:34 PM UTC-5, larry wrote: > > *I would use python string formatting instead of the "+" operator.* > > *Try something like:* > > *imagePath="%sicons/staircon.jpg"%**mc.internalVar(userPrefDir=True)* > > > *instead of:imagePath = mc.internalVar(userPrefDir=True) > +'icons/stairIcon.jpg'* > > *More info:* > > > *http://www.diveintopython.net/native_data_types/formatting_strings.html > <http://www.diveintopython.net/native_data_types/formatting_strings.html>* > > On Mon, Aug 10, 2015 at 9:13 AM, Kate Sendall <kate.alic...@googlemail.com > <javascript:>> wrote: > >> Are you kidding me? That's it! Thank you so much, haha. I was using an >> american set keyboard and a small screen. The two obviously don't mix well. >> >> Perfect answer. >> >> On Sunday, August 9, 2015 at 4:41:43 PM UTC+1, ABHIRAJ KK wrote: >>> >>> *Hi, kate * >>> >>> *check the icons "i" in ur code i think u have used some special >>> characters * >>> >>> *imagePath = mc.internalVar(userPrefDir=True) +'icons/stairIcon.jpg'* >>> *mc.image(image=imagePath)* >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Python Programming for Autodesk Maya" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to python_inside_maya+unsubscr...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/python_inside_maya/8d601779-da77-4d79-9c5c-704583697a91%40googlegroups.com >> >> <https://groups.google.com/d/msgid/python_inside_maya/8d601779-da77-4d79-9c5c-704583697a91%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/0e34b1fe-7332-443c-bb05-662d20ea3892%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.