Re: [Tutor] Interacting with stderr

2014-08-30 Thread Cameron Simpson
On 30Aug2014 22:32, Crush wrote: Thank you Allan for your criticism. Please see the below changes. As far as the embedded loops, I know no other way to achieve the same out come. Regrettably I've lost Alan's email on that (I had it:-). It looks like you've taken he concern over nested use of

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

2014-08-30 Thread Danny Yoo
> > Everything seems to be working, but, when I try to really use the program > and convert something change the spinBox value I get: > > > ### > Traceback (most recent call last): > File "C:/.../currency.py", line 20, in update_ui > amount = (rates[from_] / rates[to]) * fromSpinBox.value() >

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

2014-08-30 Thread Danny Yoo
On Sat, Aug 30, 2014 at 7:49 PM, Juan Christian wrote: > Let's see, the print is just "debug", it's not necessary in the program. > > 'row[0]' is the first element of the current row. Ex.: row = ['a', 'b', 'c', > 'd'] - row[0] would be 'a' > > 'rates' is a dictionary, 'rates[row[0]]' would update

Re: [Tutor] Tutor Digest, Vol 126, Issue 86

2014-08-30 Thread Crush
Thank you Allan for your criticism. Please see the below changes. As far as the embedded loops, I know no other way to achieve the same out come. def kill_proc(process1, process2): i = psutil.Popen(["ps", "cax"], stdout=PIPE) out, err = i.communicate() for proc in psutil.process_iter():

Re: [Tutor] Interacting with stderr

2014-08-30 Thread Crush
Ok, i understand the dangers of using root. I will bring this to the attention of the CTO of the company, which he should know already, but none the less. You must know though, I do not have the power to change the way things are done. If he says "ahhh, dont worry about it," then what am I to do

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

2014-08-30 Thread Danny Yoo
As the error message suggests, the problem might be near line 40. Look at lines 40 and 41 in your program. print(rates[row[0]] + " / VALUE : " + str(value)) rates[row[0]] = value Look at it very carefully, and try to explain to yourself what those two lines mean.

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

2014-08-30 Thread Danny Yoo
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 urll

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

2014-08-30 Thread Danny Yoo
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

Re: [Tutor] Interacting with stderr

2014-08-30 Thread Danny Yoo
>>> One other thing: if you can avoid running commands as root, I'd >>> strongly suggest doing so. Your second screenshot shows that you're >>> running as root superuser, and the imaginary security demon that sits >>> on my left shoulder is laughing uproariously as we speak. >> >> Haha Yes I am aw

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

2014-08-30 Thread Juan Christian
Sorry for double-post. I did as you said, now I get this: [image: Imagem inline 1] I did a 'print(line)' and it seems to be working, " b'# The daily noon exchange rates for major foreign currencies are published every business day at about 12:30' ". Code: http://pastebin.com/SgVdeKGm 2014-08-

Re: [Tutor] interacting with stderr

2014-08-30 Thread Alan Gauld
On 30/08/14 23:31, Bo Morris wrote: time to a more appropriate amount. Anyone see any issues with it or ways to make it better? One obvious issue: while True: while count < 15: for line in p.stderr: > if "Segmentation" in line: while restart < 3

[Tutor] interacting with stderr

2014-08-30 Thread Bo Morris
Here is my working code. It works great in the lab, but I still need to test it on a live system. I also need to add the email notifications to it, but I purposely left them out for now; I will also adjust the sleep time to a more appropriate amount. Anyone see any issues with it or ways to make it

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

2014-08-30 Thread Juan Christian
I analyzed the code and found two mistakes: 1. I wrote 'startsWith', and not 'startswith' 2. I forgot to encode, I needed to use '.read().decode("utf-8")' rather than '.read()' only. This way I get the text correctly (http://pastebin.com/qy4SVdzK). I'm still analyzing the code and fixing things,

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

2014-08-30 Thread Danny Yoo
> So the loop really should be: > > for line in fh.split("\n"): > ... Ah, apologies. Forgot that we're in Python 3 land. We have to be consistent with the types a lot more. This should be: for line in fh.split(b"\n"): ... Apologies. I should hav

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

2014-08-30 Thread Danny Yoo
> Now the problem is another one... And NOT related to PySide, it's pure > Python. The problem is in the 'get_date()' func > (http://pastebin.com/mPhJcXmF) - I get all the text from bankofcanada site > but when I reach 'line.strip()' I get an error, "'int' object has no > attribute 'strip'". You'v

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

2014-08-30 Thread Juan Christian
Ops, I'm sorry, didn't know about that, anyway I already fixed the issue. I was doing 'self.fromComboBox.currentIndexChanged().connect(self.update_ui)' instead of 'self.fromComboBox.currentIndexChanged.connect(self.update_ui)' - no parenthesis. Now the problem is another one... And NOT related to

Re: [Tutor] reading strings and calculating totals

2014-08-30 Thread ALAN GAULD
total = 0 >with open('/Users/richarddillon/Desktop/numbers.txt', 'r') as infile: >   for line in infile: >       total += float(line) >print(total) > > >Python returned         "ValueError: could not convert string to float: " > >That means some of your lines are not floats - are there any blanks?

Re: [Tutor] reading strings and calculating totals

2014-08-30 Thread Richard Dillon
When I tried total = 0 with open('/Users/richarddillon/Desktop/numbers.txt', 'r') as infile: for line in infile: total += float(line) print(total) Python returned "ValueError: could not convert string to float: " Richard On Aug 30, 2014, at 1:13 PM, Alan Gauld wrote: > total

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

2014-08-30 Thread Alan Gauld
On 30/08/14 14:19, Juan Christian wrote: Hello everyone, I have a question regarding PySide 1.2.2 and Python 3.4.1 The tutor list is for people learning Python language and the standard library so Side is really a bit off topic. There are some Qt users here though so you may get a reply, but

Re: [Tutor] reading strings and calculating totals

2014-08-30 Thread Alan Gauld
On 30/08/14 17:14, Richard Dillon wrote: The total I get doesn't match the values entered in the file. def main(): total = 0 infile = open('/Users/richarddillon/Desktop/numbers.txt', 'r') # read first record line = infile.readline() a = float(line) Here you get the nu

Re: [Tutor] reading strings and calculating totals

2014-08-30 Thread Peter Otten
Richard Dillon wrote: > I apologize in advance - This is my third week using Python (3.4.1 on a > Mac) > > I need to read a text file, convert the values into numbers and calculate > a total. The total I get doesn't match the values entered in the file. > > def main(): > total = 0 > infi

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

2014-08-30 Thread Juan Christian
Hello everyone, I have a question regarding PySide 1.2.2 and Python 3.4.1 I have this code that I made following a Python tutorial , mine is a bit different because the tutorial is a bit old, and I'm trying to use Python n

[Tutor] reading strings and calculating totals

2014-08-30 Thread Richard Dillon
I apologize in advance - This is my third week using Python (3.4.1 on a Mac) I need to read a text file, convert the values into numbers and calculate a total. The total I get doesn't match the values entered in the file. def main(): total = 0 infile = open('/Users/richarddillon/Desktop/

Re: [Tutor] Printing a list count - Help

2014-08-30 Thread boB Stepp
On Fri, Aug 29, 2014 at 2:17 PM, Derek Jenkins wrote: > Hi everybody, > > I have a list that I want to go through and finally print a total > count of particular items. In this case, I want to print the result of > how many A's and B's are in the list. > > honor_roll_count = 0 > student_grades = [