I am trying to learn the Dabo and Python by doing small apps.  I was
asked by a user yesterday how to get a list of files from a network dir
into csv ( just used 'dir' and redirected output to text file ).  I
thought, "Hmm... this would make a good small Dabo app.  Popup file
chooser, pull list of files, save to text file.  Simple."  So, here I go
making it happen and run into the first issue:  I can pull choose the
folder and get a list of the files but they are apparently in unicode ? 
I put the file list as output to a textbox and here is what it looks
like (partial):

[u'[', u'u', u"'", u'[', u"'", u',', u' ', u'u', u"'", u'u', u"'", u',',
u' ', u'u', u'"', u"'", u'"', u',', u' ', u'u', u"'", u'[', u"'", u',',
u' ', u'u', u'"', u"'", u'"', u',', u' ', u'u', u"'", u',', u"'", u',',
u' ', u'u', u"'", u' ', u"'", u',', u' ', u'u', u"'", u'u', u"'", u',',
u' ', u'u', u'"', u"'", u'"', u',', u' ', u'u', u"'", u'u', u"'", u',',
u' ', u'u', u'"', u"'", u'"', u',', u' ', u'u', u"'", u',', u"'", u',',
u' ', u'u', u"'", u' ', u"'", u',', u' ', u'u', u"'", u'u', u"'", u',',
u' ', u'u', u"'", u'"', u"'", u',', u' ', u'u', u'"', u"'", u'"', u',',
u' ', u'u', u"'", u'"', u"'", u',', u' ', u'u', u"'", u',', u"'", u',',
u' ', u'u', u"'", u' ', u"'", u',', u' ', u'u', u"'", u'u', u"'", u',',
u' ', u'u', u'"', u"'", u'"', u',', u' ', u'u', u"'", u' ', u"'", u',',
u' ', u'u', u'"', u"'", u'"', u',', u' ', u'u', u"'", u',', u"'", u',',
u' ', u'u', u"'", u' ', u"'", u',', u' ', u'u', u"'", u'u', u"'", u',',
u' ', u'u', u'"', u"'", u'"', u',', u' ', u'u', u"'", u'D', u"'", u',',
u' ', u'u', u'"', u"'", u'"', u',', u' ', u'u', u"'", u',', u"'", u',',
u' ', u'u', u"'", u' ', u"'", u',', u' ', u'u', u"'", u'u', u"'", u',',
u' ', u'u', u'"', u"'", u'"', u',', u' ', u'u', u"'", u'a', u"'", u',',
u' ', u'u', u'"', u"'", u'"', u',', u' ', u'u', u"'", u',', u"'", u',',
u' ', u'u', u"'", u' ', u"'", u',', u' ', u'u', u"'",

Here is my onHit for the Choose Path button:

def onHit(self, evt):
    import os
    fpath = dabo.ui.getFolder(message="Choose a folder", defaultPath="",
wildcard="*")
    self.Form.lblPath.Caption = fpath
    if fpath:
            fdlist = os.listdir(fpath)
            fdlist.sort()
            flist = [ elem for elem in fdlist if os.path.isfile(elem) ]
            self.Form.txtBox.Value = flist

How can I get this into a format that is usable to me?

Thanks,
Brian


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Reply via email to