shurain / chm2pdf

Automatically exported from code.google.com/p/chm2pdf
GNU General Public License v2.0
0 stars 0 forks source link

Learn hardware-parts! Python too. #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. download source
2. unpack to disk
3. look at source script, line 146

What is the expected output? What do you see instead?
144    f=open(output_file,'w')
145    f.write(page)
146    f.close    # BUG! <=========== MISSED "()"
147    #hack to guarantee that the file has been wholly written
148    f=open(output_file,'r')
149    while len(f.read()) < len(page):
150        pass
151    f.close()

INSTEAD:
146    f.close()

there are no method calling without parenthesis :)

What version of the product are you using? On what operating system?
No matter.

Please provide any additional information below.
Use pylint or other tool to verificaton source code. 
Dont do such stupid hacks on that clear language as Python :D

Original issue reported on code.google.com by abcde...@gmail.com on 4 Feb 2008 at 12:42

GoogleCodeExporter commented 9 years ago
Huh! Didn't notice that. Thanks!

However, why does Python not complain? I'm quite confused.

Original comment by devicera...@gmail.com on 13 Mar 2008 at 7:08

GoogleCodeExporter commented 9 years ago
Hi!

in "f.close" you get <close> method of file variable <f>, but didnt used it ;)

Another right (and long) way:
=============================
close_method = f.close
close_method()
=============================

python dont report this as error by herself -- it think that you get method from
class instance, but not assigning to any variable ;)

sorry for my english

Original comment by abcde...@gmail.com on 13 Mar 2008 at 11:00

GoogleCodeExporter commented 9 years ago
Should be fixed now *blush*

Original comment by devicera...@gmail.com on 5 May 2008 at 11:27