Pardon my noob-ness in this.

Earlier I tried importing, specifically citing for a file format which is 
*.chan*
Then as I implemented the bailed-out scenario and your code that you have 
written, I got the same set of errors that I have posted previously and I 
am not getting any statement etc.

Still getting the unrecognized file error.


On Sunday, September 7, 2014 5:17:09 PM UTC+8, Justin Israel wrote:
>
> What I was saying was that if you are going to use the fileDialog 
> approach, as you did, and you see that it returns an error, you would have 
> to make sure that you take a look at the API documentation to confirm that 
> you are using it properly. In this case, the fileDialog returns an array of 
> strings, and you are passing that array to the file() command, which only 
> takes a string. So you end up with an error.
>
> Because you are using a fileDialog command that allows the user to choose 
> one existing file, you will need first check the filename variable to make 
> sure it is set to something and that the user did not cancel the dialog. 
> Because the people that designed the Maya cmds API love and value 
> consistency, you will notice that if the dialog is canceled you get back a 
> None instead of an empty list. Your check would be something like this:
>
> fileList = cmds.fileDialog2(fileMode=1, fileFilter=multipleFilters, 
> dialogStyle=2)if not fileList:
>     # return or print something or bail out early
>
> filename = fileList[0]
> cmds.file(filename, i=True)
>
> If you are allowing multiple files:
>
> fileList = cmds.fileDialog2(fileMode=4, fileFilter=multipleFilters, 
> dialogStyle=2)if not fileList:
>     # return or print something or bail out early
> for filename in fileList:
>     cmds.file(filename, i=True)
>
> At this point, you have control over knowing which file is being imported 
> and having the opportunity of doing pre/post
> ​
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/9f367c51-cb0a-4a60-a341-b7addb27e3ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to