Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Maya 2017 : Python open file API

Maya 2017 : Python open file API

Anonymous
Not applicable
764 Views
1 Reply
Message 1 of 2

Maya 2017 : Python open file API

Anonymous
Not applicable

Hi,

 

I use to make a tool to bake animations keys into a particular readable format for another device.

 

Problem :

I've wrote a part which is parsing a .CSV file in order to load a configuration file.

I've been using this :

with open('C:/QUARANTINES/config_tmp.csv','wb') as csvfile:
# specific delimiter
reader = csv.reader(csvfile,delimiter=',',quotechar='|')
for row in reader :
# each row consists parameters delimited by ','
//doSomething forEach row

But it's not working anymore.

 

 

I'm digging into stackOverflow at the moment, to see if there's anything new, but I haven't found anything relevant yet...

 

Does anybody have a clue ? I'd appreciate 🙂

 

EDIT : To be accurate ; I precede this by import csv. I've been using this https://docs.python.org/2/library/csv.html?highlight=reader#csv.reader

 

0 Likes
765 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

Hi Arthur

 

It looks like you are trying to read a csv file, but you have used a write operation on your call to open. Change this line

 

with open('C:/QUARANTINES/config_tmp.csv','wb') as csvfile:

to this:

 

with open('C:/QUARANTINES/config_tmp.csv','rb') as csvfile:

And it seems to work fine.

 

Hope it helps

 

Cheers

 

Mike

0 Likes