Why 'files.py' does not print the filenames into a table format?

Joshua Landau joshua.landau.ws at gmail.com
Sat Jun 15 16:37:05 EDT 2013


On 15 June 2013 20:51, Nick the Gr33k <support at superhost.gr> wrote:
> On 15/6/2013 10:46 μμ, Jarrod Henry wrote:
>>
>> Nick, at this point, you need to hire someone to do your work for you.
>
>
> The code is completely ready.
> Some detail is missing and its not printing the files as expected.

Look, Nick,

A lot of people are frustrated by you. You should understand that. If
you cannot, you need to step back and consider, or you really are a
troll.

Now, obviously it's not going to get you any help to have half of the
forum angry at you. People have stopped helping, at least in large.
This is fine; people here are volunteers. But you want help.

So, Nick, listen. You need to learn how to ask *smart* questions. If
you do, I *guarantee* that people will respect you a lot more. I'll be
willing to give a bit of time to explain what I mean.

1) What is your problem. Not "I want to know why it doesn't print
anything." Here's an example, for some random idea:

> I've written some code to find the first file in a directory which
> is not UTF-8. Lines 40-42 are meant to print out the file found
> to a log ("/home/joshua/.logs/log"). Unfortunately, although
> there is no error, no file is printed to the log.

2) What have you tried? What debugging have you done? For someone of
your skill level, it's also important to tell us what you think your
code is doing. Example:

> I've tried checking for a failure - when there is no non-UTF-8 file
> in the directory the appropriate error is raised. I think this should
> mean that the "else" after the "for" loop would be run, and this
> should run the lines 40-42 above when there *is* a non-UTF-8
> file.

3) If possible, give us an example we can run.

> To make helping easier, I've removed the code that searches the
> directory as I know that works, and instead there's a list of BytesIO
> and StringIO objects that pretend to be them. The bug is still
> there.

Do you see the difference?

> Irrelevant to my question i just noticed weird behavior about my
> pelatologio.py script which can be seen here:
>
> http://superhost.gr/?show=stats
>
> The first 3 files are of my doing.
> All the rest are of someone else's that managed to append entries into my
> counters database utilizing this code:
>
> ================
>
>         try:
>                 #find the needed counter for the page URL
>                 cur.execute('''SELECT ID FROM counters WHERE url = %s''',
> page )
>                 data = cur.fetchone()        #URL is unique, so should only
> be one
>
>                 if not data:
>                         #first time for page; primary key is automatic, hit
> is defaulted
>                         cur.execute('''INSERT INTO counters (url) VALUES
> (%s)''', page )
>                         cID = cur.lastrowid        #get the primary key
> value of the new record
> ======================
>
> Does someone want to state something?

Sure. Here I go:

What's the question?



More information about the Python-list mailing list