PDA

View Full Version : shelve module not working as expected in maya 2013


DEVILSAN
11-14-2012, 11:53 AM
well I want user to be able to save ftp information to disk instead of entering it into application, so since its not big app i did not wanted to make things complex, so i am using shelve module

the code works fine if I run in external interpreter, but if I import the module from inside maya I dont get the ftp.db file.
from minime import *
import maya.cmds as cmds
import shelve
from contextlib import closing

class DataAccess(object):
def __init__(self):
self.accessBI=BaseInitializer()
self.userName=self.accessBI.userName
self.ftpServer=cmds.textField('ftpText',q=True,tx=True)
self.ftpDirectory=cmds.textField('directText',q=True,tx=True)
self.ftpusrName=cmds.textField('userTxt',q=True,tx=True)
self.ftpPasswd=cmds.textField('passTxt',q=True,tx=True)

def writeFTPinfotoDisk(self):

ftpData= os.path.join(self.accessBI.minimeDir,"ftp.db")
newD={'ftpServer':self.ftpServer,'ftpDirectory':self.ftpDirectory,'ftpusrName':self.ftpusrName,'ftpPasswd':self.ftpPasswd}
print newD
print ftpData
with closing(shelve.open(ftpData)) as s:
print type(s)
s['ftp']={'ftpServer':self.ftpServer,'ftpDirectory':self.ftpDirectory,'ftpusrName':self.ftpusrName,'ftpPasswd':self.ftpPasswd}


def readFTPinfofromDisk(self):
pass

accss=DataAccess()
accss.writeFTPinfotoDisk() the pyhton versions for maya i.e 2.6 is same as I use with external interpreter...

i really wanted to shelve module, since i find it easier and i can just use key to put other dictionary objects into same db file.

CGTalk Moderation
11-14-2012, 11:53 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.