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

Juan Christian juan0christian at gmail.com
Sun Aug 31 03:26:25 CEST 2014


I'm changing so much the code that I got lost now.

Code so far: http://pastebin.com/u4xwZuyJ

I'm getting this error. 'value = float(row[-1])' is getting the values OK,
but when I do 'rates[row[0]] = value' it screws things up.

===========================
Traceback (most recent call last):
  File "C:.../currency.py", line 48, in <module>
    date = get_rates()
  File "C:.../currency.py", line 40, in get_rates
    print(rates[row[0]] + " / VALUE : " + str(value))
KeyError: 'U.S. dollar '

Process finished with exit code 1
===========================


2014-08-30 21:43 GMT-03:00 Danny Yoo <dyoo at hashcollision.org>:

> Hi Juan,
>
> Wait, you are working with a CSV file, right?  You should not be
> trying to parse this by hand if you can avoid it: there's a 'csv'
> parser library in the Standard Library.
>
>     https://docs.python.org/3.1/library/csv.html
>
> So:
>
> ####################################
> import codecs
> import urllib.request
> import csv
>
> urlString = "http://www.bankofcanada.ca/en/markets/csv/exchange_eng.csv"
> rawFile = urllib.request.urlopen(urlString)
> decodedFile = codecs.getreader("utf-8")(rawFile)
> rows = csv.reader(decodedFile)
>
> for row in rows:
>     print(repr(row))
> #######################################
>
>
> should take better advantage of what the Standard Library provides
> you: then you just deal with the records.  You might have to do a
> little to filter out the beginning comment lines, but that shouldn't
> be too bad.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140830/66640abf/attachment.html>


More information about the Tutor mailing list