From: [email protected]
[mailto:[email protected]] On Behalf Of Marc
Tompkins
Sent: Tuesday, September 13, 2011 12:38 PM
To: [email protected]
Subject: Re: [Tutor] Unusual pathfile
Susana -
I think I speak for everyone when I say: don't go away! Nobody's complaining
about your question; that's what the list is for.
However, we're all human beings, and all doing this voluntarily. So it's in
your best interest to make your questions easy for us to read. So many lines
all run together, with only one space of indentation, makes my head hurt when I
try to read it; I'm ashamed to admit that I simply skipped over your question
when you first posted it. Others put more effort into it, and have told you
why it was hard for them. Don't be offended! At least they took the trouble,
which is more than I did.
Two things you can do to make this better:
- Set your text editor to convert tabs to spaces, preferably four spaces.
This is a Good Thing To Do anyway, because some of the hardest bugs to find -
for you as well as for us - happen when Python gets confused about levels of
indentation. If you're not sure how to change that setting, just tell us which
editor you use and someone can help with that.
- When you ask a question - and we WANT you to ask questions! - try to narrow
down your program to just the part that's giving you trouble. It makes it MUCH
easier for us to help you, and quite often it helps you to find the problem
yourself. As Steven said above, at the moment I can't even see which part of
your code is generating "C:\/Python26", let alone help you to correct it.
Just remember: we all want to help; speaking for myself, I started out asking
questions on this list and have stuck around to answer them. But we're all
human too - and speaking for myself, sometimes we're a little lazy.
=======================================================================================
Not to mention, all of us have different levels of understanding for languages.
I understand English, but little else. :)
I think I can narrow down the problem section. (And this is my third try. As I
was indenting, I saw that I could continue narrowing down the section).
def buscar():
print 'Iniciando...'
gdal.AllRegister()
file_list = []
folders = None
for root, folders, files in os.walk(dir):
### Add print statement here ##
file_list.extend(os.path.join(root,fi) for fi in files if
fi.endswith(extn))
I am not very familiar with the os module, but I would suggesting adding a
print/debug statement in the loop to print root, folders, files so that you can
see if something incorrect is happening. This will also give you a much better
"stack trace" to see the progress of your application.
Small sample of what I got:
<snip>
c:\tmp\m2\localrepo\saxpath ['saxpath'] []
c:\tmp\m2\localrepo\saxpath\saxpath ['1.0-FCS'] []
c:\tmp\m2\localrepo\saxpath\saxpath\1.0-FCS [] ['saxpath-1.0-FCS.jar',
'saxpath-1.0-FCS.jar.sha1', 'saxpath-1.0-FCS.pom', 'saxpath-1.0-FCS.pom.sha1',
'_maven.repositories']
<snip>
This does not show the behavior you are suggesting. Is there somewhere else
that you were referring to? Is it possible you are changing directory or
something in the middle of the os.walk command and that is causing it to
re-execute the walk?
(Python 2.6 / Win7)
Ramit
Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423
This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email. _______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor