By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,767 Members | 2,114 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,767 IT Pros & Developers. It's quick & easy.

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

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

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

my code is :
Expand|Select|Wrap|Line Numbers
  1. class Client(Object):
  2.   def __init__(self, props):
  3.     self.props = props
  4.     System.setProperty("orbitz.props", props)
  5.  
  6.     paths = []
  7.  
  8.     dn = os.path.dirname(props)
  9.     paths.append(File(dn))
  10.  
  11.     sar = dn
  12.     for root, dns, fns in os.path.walk(sar):
  13.       for fn in fns:
  14.         if fn.endswith("zip") or fn.endswith("jar"):
  15.           paths.append(File(os.path.join(root, fn)))
  16.  
  17.     paths = [File(x.getCanonicalPath()) for x in paths]
May 16 '07 #1
Share this Question
Share on Google+
1 Reply


ilikepython
Expert 100+
P: 844
i'm new to python script , i'm getting following error while executing

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

my code is :

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]
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.
May 17 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.