[Tutor] PySide 1.2.2 and Python 3 - "native Qt signal is not callable"

Danny Yoo dyoo at hashcollision.org
Sun Aug 31 02:33:52 CEST 2014


Hi Juan,

Take out your try/except block.  It's "lying" in the sense that what's
problematic isn't the failure to download.  The exception handling is
not doing well: it's hiding the true cause of the problem.

After you take the exception handler out, try again.  The error
message should be a lot more localized and tell you exactly what line
number is raising the runtime error.


Ideally, you should read the file-like object progressively, rather
than suck the whole thing at once.  Something like the following:

###############################
import codecs
import urllib.request
urlString = "http://www.bankofcanada.ca/en/markets/csv/exchange_eng.csv"
rawFile = urllib.request.urlopen(urlString)
decodedFile = codecs.getreader("utf-8")(rawFile)
for line in decodedFile:
    print(repr(line))
###############################

shows that you can do the decoding on-the-fly.


More information about the Tutor mailing list