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 and instead i get 3 files i.e. ftp.db.dat, ftp.db.dir, ftp.db.bak
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 use shelve module, since i find it easier and i can just use key to put other dictionary objects into same db file.