os.walk() error ( Can anybody please help me)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • schellu
    New Member
    • May 2007
    • 1

    os.walk() error ( Can anybody please help me)

    i'm new to python script , i'm getting following error while executing

    AttributeError: class 'org.python.mod ules.os' has no attribute 'walk'

    my code is :
    Code:
    class Client(Object):
      def __init__(self, props):
        self.props = props
        System.setProperty("orbitz.props", props)
                                                                                                                                 
        paths = []
                                                                                                                                 
        dn = os.path.dirname(props)
        paths.append(File(dn))
                                                                                                                                 
        sar = dn
        for root, dns, fns in os.path.walk(sar):
          for fn in fns:
            if fn.endswith("zip") or fn.endswith("jar"):
              paths.append(File(os.path.join(root, fn)))
                                                                                                                                 
        paths = [File(x.getCanonicalPath()) for x in paths]
    Last edited by bartonc; May 18 '07, 01:02 AM. Reason: added [code][/code] tags
  • ilikepython
    Recognized Expert Contributor
    • Feb 2007
    • 844

    #2
    Originally posted by schellu
    i'm new to python script , i'm getting following error while executing

    AttributeError: class 'org.python.mod ules.os' has no attribute 'walk'

    my code is :

    class Client(Object):
    def __init__(self, props):
    self.props = props
    System.setPrope rty("orbitz.pro ps", props)

    paths = []

    dn = os.path.dirname (props)
    paths.append(Fi le(dn))

    sar = dn
    for root, dns, fns in os.path.walk(sa r):
    for fn in fns:
    if fn.endswith("zi p") or fn.endswith("ja r"):
    paths.append(Fi le(os.path.join (root, fn)))

    paths = [File(x.getCanon icalPath()) for x in paths]
    You are probably not getting a response because you posted in the articles section. Post this in the python forum and more people can help you.

    Comment

    Working...