Re: How to add a current string into an already existing list

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 8:54 πμ, ο/η Nick the Gr33k έγραψε: Στις 5/11/2013 12:46 πμ, ο/η Denis McMahon έγραψε: On Mon, 04 Nov 2013 19:03:58 +0200, Nick the Gr33k wrote: There is no built in support in the python / mysql system for puttinga list straight into a database, because mysql does not

Re: How to add a current string into an already existing list

2013-11-05 Thread Chris Angelico
On Tue, Nov 5, 2013 at 7:07 PM, Nick the Gr33k nikos.gr...@gmail.com wrote: How is ti possible for data to be none iterable? Do you know how to call a method in Python? If not, go back to the beginning of the tutorial and start reading. If so, look through your code and see where you have a

Re: How to add a current string into an already existing list

2013-11-05 Thread Antoon Pardon
Op 05-11-13 09:21, Chris Angelico schreef: On Tue, Nov 5, 2013 at 7:07 PM, Nick the Gr33k nikos.gr...@gmail.com wrote: How is ti possible for data to be none iterable? Do you know how to call a method in Python? If not, go back to the beginning of the tutorial and start reading. If so, look

Re: How to add a current string into an already existing list

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 10:21 πμ, ο/η Chris Angelico έγραψε: On Tue, Nov 5, 2013 at 7:07 PM, Nick the Gr33k nikos.gr...@gmail.com wrote: How is ti possible for data to be none iterable? Do you know how to call a method in Python? If not, go back to the beginning of the tutorial and start reading. If

Re: How to add a current string into an already existing list

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 10:21 πμ, ο/η Chris Angelico έγραψε: On Tue, Nov 5, 2013 at 7:07 PM, Nick the Gr33k nikos.gr...@gmail.com wrote: How is ti possible for data to be none iterable? Do you know how to call a method in Python? If not, go back to the beginning of the tutorial and start reading. If

Re: Trouble with utf-8 values

2013-11-05 Thread Peter Otten
Ulrich Goebel wrote: Hallo, again: a python beginner problem... but I spent ours to solve it without success. I have an object (a variable) name, which gets its value from a PostgreSQL database via a SELECT statement, an it sometimes has german special characters as ß, ä, ö... Then I

Re: Compiling Python 3.3.2 on CentOS 6.4 - unable to find compiled OpenSSL?

2013-11-05 Thread Christian Heimes
Am 05.11.2013 01:23, schrieb Victor Hooi: Hi, We have a machine running CentOS 6.4, and we're attempting to compile Python 3.3.2 on it: # cat /etc/redhat-release CentOS release 6.4 (Final) We've compiled openssl 1.0.1e 11 by hand on this box, and installed it into

Re: How to add a current string into an already existing list

2013-11-05 Thread M.F.
On 11/05/2013 04:54 PM, Nick the Gr33k wrote: === data = cur.fetchall data = cur.fetchall() That is what the stack trace and Christ tried to inform you. for row in data: === The only thing i can understand by looking the above 2 lines is this: 'for' fails to iterate

Re: Compiling Python3 for BeagleBone Black (Angstrom distro)

2013-11-05 Thread Amirouche Boubekki
Use this http://hg.python.org/cpython/file/92022b45e60b/setup.py#l36 Add the list of modules you want to disable and redo make 2013/11/5 Travis Griggs travisgri...@gmail.com On Nov 4, 2013, at 9:22 AM, Travis Griggs travisgri...@gmail.com wrote: I'm playing with a BeagleBone Black running

Re: How to add a current string into an already existing list

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 11:10 πμ, ο/η M.F. έγραψε: On 11/05/2013 04:54 PM, Nick the Gr33k wrote: === data = cur.fetchall data = cur.fetchall() That is what the stack trace and Christ tried to inform you. for row in data: === The only thing i can understand by looking the

Re: How to add a current string into an already existing list

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 11:34 πμ, ο/η Nick the Gr33k έγραψε: Στις 5/11/2013 11:10 πμ, ο/η M.F. έγραψε: On 11/05/2013 04:54 PM, Nick the Gr33k wrote: === data = cur.fetchall data = cur.fetchall() That is what the stack trace and Christ tried to inform you. for row in data:

Re: How to add a current string into an already existing list

2013-11-05 Thread Antoon Pardon
Op 05-11-13 10:10, M.F. schreef: On 11/05/2013 04:54 PM, Nick the Gr33k wrote: === data = cur.fetchall data = cur.fetchall() That is what the stack trace and Christ tried to inform you. And now you have depraved Nikos of the opportunity to really learn something. I'm willing to

Re: How to add a current string into an already existing list

2013-11-05 Thread Antoon Pardon
Op 05-11-13 10:56, Nick the Gr33k schreef: Στις 5/11/2013 11:34 πμ, ο/η Nick the Gr33k έγραψε: Στις 5/11/2013 11:10 πμ, ο/η M.F. έγραψε: On 11/05/2013 04:54 PM, Nick the Gr33k wrote: === data = cur.fetchall data = cur.fetchall() That is what the stack trace and Christ tried to

Re: How to add a current string into an already existing list

2013-11-05 Thread Chris Angelico
On Tue, Nov 5, 2013 at 8:10 PM, M.F. moref...@gmail.com wrote: That is what the stack trace and Christ tried to inform you. Let's go with and Chris tried... no need to promote me to deity status :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: How to add a current string into an already existing list

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 12:20 μμ, ο/η Antoon Pardon έγραψε: Did you read the documentation of fetchone? fetchone is like fetchall except from the fact that the former returned a row of data while the latter returned a list of rows of data. I dont know why it copmains about: TypeError: 'NoneType'

Re: How to add a current string into an already existing list

2013-11-05 Thread Antoon Pardon
Op 05-11-13 11:33, Nick the Gr33k schreef: Στις 5/11/2013 12:20 μμ, ο/η Antoon Pardon έγραψε: Did you read the documentation of fetchone? fetchone is like fetchall except from the fact that the former returned a row of data while the latter returned a list of rows of data. From this

Re: How to add a current string into an already existing list

2013-11-05 Thread Dave Angel
On Tue, 05 Nov 2013 11:34:53 +0200, Nick the Gr33k nikos.gr...@gmail.com wrote: I see, but because of the traceback not being to express it more easily i was under the impression that data wasn't what i expected it to be. Exactly. So why didn't you act on that impression? Your error message

Re: How to add a current string into an already existing list

2013-11-05 Thread Dave Angel
On Tue, 05 Nov 2013 12:33:49 +0200, Nick the Gr33k nikos.gr...@gmail.com wrote: Στις 5/11/2013 12:20 μμ, ο/η Antoon Pardon έγραψε: Did you read the documentation of fetchone? fetchone is like fetchall except from the fact that the former returned a row of data while the latter returned

Re: How to add a current string into an already existing list

2013-11-05 Thread Steven D'Aprano
On Tue, 05 Nov 2013 12:33:49 +0200, Nick the Gr33k wrote: Στις 5/11/2013 12:20 μμ, ο/η Antoon Pardon έγραψε: Did you read the documentation of fetchone? fetchone is like fetchall except from the fact that the former returned a row of data while the latter returned a list of rows of

Re: How to add a current string into an already existing list

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 1:49 μμ, ο/η Steven D'Aprano έγραψε: On Tue, 05 Nov 2013 12:33:49 +0200, Nick the Gr33k wrote: Στις 5/11/2013 12:20 μμ, ο/η Antoon Pardon έγραψε: Did you read the documentation of fetchone? fetchone is like fetchall except from the fact that the former returned a row of

Re: How to add a current string into an already existing list

2013-11-05 Thread Antoon Pardon
Op 05-11-13 13:25, Nick the Gr33k schreef: # fetch those columns that act as lists but are stored as strings cur.execute('''SELECT refs, visits, downloads FROM visitors WHERE counterID = %s and host = %s''', (cID, host) ) data = cur.fetchone() print( type(data) ) sys.exit(0) i

Re: How to add a current string into an already existing list

2013-11-05 Thread Dave Angel
On Tue, 05 Nov 2013 14:25:41 +0200, Nick the Gr33k nikos.gr...@gmail.com wrote: i tried inserting a type function to notify me of the datatype of 'data' but that didnt help too. What did that print show ? In what way didn't it help? It said the type was Charles It didn'tprint anything It

how to find out utf or not

2013-11-05 Thread Mohsen Pahlevanzadeh
Dear all, Suppose i have a variable such as : myVar = 'x' May be it initialized with myVar = u'x' or myVar = 'x' So i need determine content of myVar that it's utf-8 or not, how can i do it? --mohsen -- https://mail.python.org/mailman/listinfo/python-list

Re: how to find out utf or not

2013-11-05 Thread Dave Angel
On Tue, 05 Nov 2013 16:32:57 +0330, Mohsen Pahlevanzadeh moh...@pahlevanzadeh.org wrote: Suppose i have a variable such as : myVar = 'x' May be it initialized with myVar = u'x' or myVar = 'x' So i need determine content of myVar that it's utf-8 or not, how can i do it? Use the type()

Re: how to find out utf or not

2013-11-05 Thread Neil Cerutti
On 2013-11-05, Dave Angel da...@davea.name wrote: On Tue, 05 Nov 2013 16:32:57 +0330, Mohsen Pahlevanzadeh moh...@pahlevanzadeh.org wrote: Suppose i have a variable such as : myVar = 'x' May be it initialized with myVar = u'x' or myVar = 'x' So i need determine content of myVar that it's

Re: How to add a current string into an already existing list

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 3:15 μμ, ο/η Dave Angel έγραψε: On Tue, 05 Nov 2013 14:25:41 +0200, Nick the Gr33k nikos.gr...@gmail.com wrote: i tried inserting a type function to notify me of the datatype of 'data' but that didnt help too. What did that print show ? In what way didn't it help? It said

Re: How to add a current string into an already existing list

2013-11-05 Thread Tim Chase
On 2013-11-05 17:39, Nick the Gr33k wrote: data = infile.readlines You're assigning it to the bound function rather than calling the function. Use the call operator: data = infile.readlines() -tkc -- https://mail.python.org/mailman/listinfo/python-list

Re: How to add a current string into an already existing list

2013-11-05 Thread Joel Goldstick
As I read this thread, the original question was how to stuff multiple values in a single sql column. Several people pointed out that the proper way to handle multiple values related to the original table is to use a second table or perhaps a many to many relationship with and intermediate join

Re: How to add a current string into an already existing list

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 5:45 μμ, ο/η Tim Chase έγραψε: On 2013-11-05 17:39, Nick the Gr33k wrote: data = infile.readlines You're assigning it to the bound function rather than calling the function. Use the call operator: data = infile.readlines() -tkc -- infile=open(myfile.txt) data =

Re: how to find out utf or not

2013-11-05 Thread Steven D'Aprano
On Tue, 05 Nov 2013 16:32:57 +0330, Mohsen Pahlevanzadeh wrote: Dear all, Suppose i have a variable such as : myVar = 'x' May be it initialized with myVar = u'x' or myVar = 'x' Can't you just look at the code and tell which it is? So i need determine content of myVar that it's utf-8 or

Re: How to add a current string into an already existing list

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 1:16 μμ, ο/η Dave Angel έγραψε: On Tue, 05 Nov 2013 12:33:49 +0200, Nick the Gr33k nikos.gr...@gmail.com wrote: Στις 5/11/2013 12:20 μμ, ο/η Antoon Pardon έγραψε: Did you read the documentation of fetchone? fetchone is like fetchall except from the fact that the former

Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
== # fetch those columns that act as lists but are stored as strings cur.execute('''SELECT refs, visits, downloads FROM visitors WHERE counterID = %s and host = %s''', (cID, host) ) data = cur.fetchone() ref

Re: Help me with this code PLEASE

2013-11-05 Thread Antoon Pardon
= IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS TO LISTS 3. ADD SOME CURRENT VALUES TO THOSE LISTS 4. CONVERT FROM

Re: Help me with this code PLEASE

2013-11-05 Thread mm0fmf
EVERYHTIGN I TRIED FAILED. Maybe try some of the advice you have been given instead? -- https://mail.python.org/mailman/listinfo/python-list

Re: Help me with this code PLEASE

2013-11-05 Thread Steven D'Aprano
On Tue, 05 Nov 2013 19:06:25 +0200, Nick the Gr33k wrote: ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS TO LISTS 3. ADD SOME CURRENT VALUES TO THOSE LISTS 4. CONVERT FROM LISTS TO LONG STRINGS SO I CAN STORE SUCCESSFULLY LIST

Re: How to add a current string into an already existing list

2013-11-05 Thread Denis McMahon
On Tue, 05 Nov 2013 11:34:53 +0200, Nick the Gr33k wrote: data = cur.fetchall for row in data: I see, but because of the traceback not being to express it more easily i was under the impression that data wasn't what i expected it to be. data wasn't what you expected it to be. The problem

Re: Help me with this code PLEASE

2013-11-05 Thread Antoon Pardon
Op 05-11-13 18:41, Steven D'Aprano schreef: On Tue, 05 Nov 2013 19:06:25 +0200, Nick the Gr33k wrote: ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS TO LISTS 3. ADD SOME CURRENT VALUES TO THOSE LISTS 4. CONVERT FROM LISTS TO LONG

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 7:41 μμ, ο/η Steven D'Aprano έγραψε: On Tue, 05 Nov 2013 19:06:25 +0200, Nick the Gr33k wrote: ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS TO LISTS 3. ADD SOME CURRENT VALUES TO THOSE LISTS 4. CONVERT FROM LISTS TO

Re: Help me with this code PLEASE

2013-11-05 Thread Denis McMahon
On Tue, 05 Nov 2013 19:06:25 +0200, Nick the Gr33k wrote: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. Try starting with something simple. The following is a step by step guide to working out how you need to do this. Follow all the steps. Do not skip any steps. Each stage

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 8:02 μμ, ο/η Denis McMahon έγραψε: On Tue, 05 Nov 2013 19:06:25 +0200, Nick the Gr33k wrote: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. Try starting with something simple. The following is a step by step guide to working out how you need to do this. Follow

Re: Help me with this code PLEASE

2013-11-05 Thread Tobiah
All this problem arises because MySQL's hasn't got a datatype able to store an array of elements, a list. Um, yes it does. It's called a table. -- https://mail.python.org/mailman/listinfo/python-list

Re: Help me with this code PLEASE

2013-11-05 Thread Joel Goldstick
On Tue, Nov 5, 2013 at 1:11 PM, Tobiah t...@tobiah.org wrote: All this problem arises because MySQL's hasn't got a datatype able to store an array of elements, a list. Um, yes it does. It's called a table. -- https://mail.python.org/mailman/listinfo/python-list Perhaps we are splitting

Re: Help me with this code PLEASE

2013-11-05 Thread Denis McMahon
On Tue, 05 Nov 2013 20:09:42 +0200, Nick the Gr33k wrote: Denis, i have already provided my code trying to do what i need and i need some commendation on how to make it work. Nick, you're obviously trying to code way above your abilities. If you want me to write your code, you will have to

Re: Help me with this code PLEASE

2013-11-05 Thread John Gordon
In l5b8if$4k1$1...@dont-email.me Nick the Gr33k nikos.gr...@gmail.com writes: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS TO LISTS 3. ADD SOME CURRENT VALUES TO

Re: Help me with this code PLEASE

2013-11-05 Thread Mark Lawrence
On 05/11/2013 20:19, John Gordon wrote: In l5b8if$4k1$1...@dont-email.me Nick the Gr33k nikos.gr...@gmail.com writes: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 5/11/2013 10:19 μμ, ο/η John Gordon έγραψε: In l5b8if$4k1$1...@dont-email.me Nick the Gr33k nikos.gr...@gmail.com writes: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG

Re: Help me with this code PLEASE

2013-11-05 Thread Mark Lawrence
On 05/11/2013 21:17, Mark Lawrence wrote: On 05/11/2013 20:19, John Gordon wrote: In l5b8if$4k1$1...@dont-email.me Nick the Gr33k nikos.gr...@gmail.com writes: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST

Re: Help me with this code PLEASE

2013-11-05 Thread Chris Angelico
On Wed, Nov 6, 2013 at 8:17 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: I've taken a different approach. I've put the contract out to tender and hereby give you the winners http://www.mudefordwoodcommunitycentre.co.uk/playgroup-and-tiny-tots/ Sounds good! But I don't see a list of their

Re: Help me with this code PLEASE

2013-11-05 Thread John Gordon
In l5bnpc$71v$1...@dont-email.me Nick the Gr33k nikos.gr...@gmail.com writes: # fetch those columns that act as lists but are stored as strings cur.execute('''SELECT refs, visits, downloads FROM visitors WHERE counterID = %s and host = %s''', (cID, host) )

Re: Help me with this code PLEASE

2013-11-05 Thread Piet van Oostrum
Nick the Gr33k nikos.gr...@gmail.com writes: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS TO LISTS 3. ADD SOME CURRENT VALUES TO THOSE LISTS 4. CONVERT FROM LISTS TO

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 6/11/2013 12:06 πμ, ο/η John Gordon έγραψε: In l5bnpc$71v$1...@dont-email.me Nick the Gr33k nikos.gr...@gmail.com writes: # fetch those columns that act as lists but are stored as strings cur.execute('''SELECT refs, visits, downloads FROM visitors WHERE

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 6/11/2013 12:15 πμ, ο/η Piet van Oostrum έγραψε: Nick the Gr33k nikos.gr...@gmail.com writes: IAM STRUGGLING WITH IT 2 DAYS NOW AND I CANNOT GET IT TO WORK. ALL I WANT IT TO DO IS JUST 1. RETRIEVE 3 COLUMNS THAT CONSIST OF 3 LONG STRINGS 2. CONVERT LONG STRINGS TO LISTS 3. ADD SOME

Re: Help me with this code PLEASE

2013-11-05 Thread Mark Lawrence
On 05/11/2013 22:28, Nick the Gr33k wrote: Στις 6/11/2013 12:06 πμ, ο/η John Gordon έγραψε: In l5bnpc$71v$1...@dont-email.me Nick the Gr33k nikos.gr...@gmail.com writes: # fetch those columns that act as lists but are stored as strings cur.execute('''SELECT refs, visits,

Re: Help me with this code PLEASE

2013-11-05 Thread John Gordon
In l5brem$trk$1...@dont-email.me Nick the Gr33k nikos.gr...@gmail.com writes: The code i provided only worked once before it failed and managed to store this: counterID,host,refs,city,userOS,browser,visits,hits,download -

Re: Help me with this code PLEASE

2013-11-05 Thread Cameron Simpson
On 05Nov2013 20:09, Nikos nikos.gr...@gmail.com wrote: O even better an rdbms than allows complex data such as tuples, lists, dicts to be saved into the db as they are so i dont have to cobvet back and forth each time. If you're just using the db for storage or adhoc and arbitrary python

Re: Help me with this code PLEASE

2013-11-05 Thread bob gailer
There is also the shelve module. It uses pickle to marshal a Python object, then stores it in a file under a key. Sample code from the module documentation: import shelve d = shelve.open(filename) # open -- file may get suffix added by low-level library d[key] = data # store data at

Re: Help me with this code PLEASE

2013-11-05 Thread Mark Lawrence
On 05/11/2013 22:31, Cameron Simpson wrote: On 05Nov2013 20:09, Nikos nikos.gr...@gmail.com wrote: O even better an rdbms than allows complex data such as tuples, lists, dicts to be saved into the db as they are so i dont have to cobvet back and forth each time. If you're just using the db

Re: how to find out utf or not

2013-11-05 Thread Gisle Vanem
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: If myVar is a Unicode string, you don't need to care about the encoding (UTF-8 or otherwise) until you're ready to write it to a file. Then I strongly recommend you always use UTF-8, unless you have to interoperate with some old,

Re: Help me with this code PLEASE

2013-11-05 Thread Denis McMahon
On Wed, 06 Nov 2013 00:35:56 +0200, Nick the Gr33k wrote: Now i realizes i just cannot store lists into it's columns because it does not support a collection datatype. All databases support storing of collections, but *NOT THE WAY YOU WANT TO DO IT* You refuse to do it the proper way, so you

Re: Help me with this code PLEASE

2013-11-05 Thread Nick the Gr33k
Στις 6/11/2013 12:54 πμ, ο/η John Gordon έγραψε: The code i provided only worked once before it failed and managed to store this: counterID,host,refs,city,userOS,browser,visits,hits,download - 1, 176-92-96-218.adsl.cyta.gr,

Re: Help me with this code PLEASE

2013-11-05 Thread Ben Finney
Denis McMahon denismfmcma...@gmail.com writes: You have been told several times by several people how to do this properly. You insist on using your bodged up solution instead. OK, we'll all try and help you bodge up a solution[…] Why? No-one here is obligated to help with implementing a

Help me with this code

2013-11-05 Thread chovdary
Hi friends help me with the following code. Im able to execute the code but getting wrong output def sequence_b(N): N = 10 result = 0 for k in xrange (1,N): result += ((-1) ** (k+1))/2*k-1 print result print sequence_b(10) This is the output which im getting -1 -4

Representing fractions (was: Help me with this code)

2013-11-05 Thread Ben Finney
chovd...@gmail.com writes: def sequence_b(N): N = 10 result = 0 for k in xrange (1,N): result += ((-1) ** (k+1))/2*k-1 Every number here is an integer. Python 2 will keep all the computations integers by default:: $ python2 1 / 2 0 You want to use Python

Re: Help me with this code

2013-11-05 Thread MRAB
On 06/11/2013 01:51, chovd...@gmail.com wrote: Hi friends help me with the following code. Im able to execute the code but getting wrong output def sequence_b(N): N = 10 result = 0 for k in xrange (1,N): result += ((-1) ** (k+1))/2*k-1 print result print

Re: Help me with this code

2013-11-05 Thread Steven D'Aprano
On Tue, 05 Nov 2013 17:51:00 -0800, chovdary wrote: Hi friends help me with the following code. Im able to execute the code but getting wrong output [snip code] You have this critical expression in your code: result += ((-1) ** (k+1))/2*k-1 It looks to me like you are using Python 2.

Re: How to add a current string into an already existing list

2013-11-05 Thread Larry Hudson
On 11/05/2013 02:07 AM, Antoon Pardon wrote: And now you have depraved Nikos of the opportunity to really learn something. ... I know you meant deprived, but depraved Nikos sounds like a good description to me. ;-) -=- Larry -=- --

Re: How to add a current string into an already existing list

2013-11-05 Thread Dave Angel
On Tue, 5 Nov 2013 09:45:15 -0600, Tim Chase python.l...@tim.thechases.com wrote: You're assigning it to the bound function rather than calling the function. Use the call operator: data = infile.readlines() Thanks for spoiling the lesson. Nicks needs to learn how to debug 4 line

Re: Help me with this code

2013-11-05 Thread Dave Angel
On Tue, 5 Nov 2013 17:51:00 -0800 (PST), chovd...@gmail.com wrote: result += ((-1) ** (k+1))/2*k-1 One of two things are happening here. Maybe both. You're using Python 2.x (and should havesaid so) where integer division is truncated. You're missing around some part of the

Re: how to find out utf or not

2013-11-05 Thread Dave Angel
On 5 Nov 2013 15:30:19 GMT, Neil Cerutti ne...@norwich.edu wrote: On 2013-11-05, Dave Angel da...@davea.name wrote: On Tue, 05 Nov 2013 16:32:57 +0330, Mohsen Pahlevanzadeh May be it initialized with myVar = u'x' or myVar = 'x' My solution assumed he wanted to distinguish between those two

Re: install package from github repository

2013-11-05 Thread C. Ng
nope there is no installation instructions -- https://mail.python.org/mailman/listinfo/python-list

Re: install package from github repository

2013-11-05 Thread C. Ng
Ok, that seems to work... I modified from another package. I don't understand how setup.py does it exactly, but got it done anyways. -- https://mail.python.org/mailman/listinfo/python-list

Adding 'download' column to existing 'visitors' table (as requested)

2013-11-05 Thread Nick the Gr33k
I have decided to take your advice. I wasn't able to fit those 'lists' of mine into MySQL's varchar() datatype after converting them to long strings and that sads me. My implementation is like the following. I do not use an extra table of downlaods that i asoociate with table visitors with a

Re: Adding 'download' column to existing 'visitors' table (as requested)

2013-11-05 Thread Nick the Gr33k
Ah great!!! I just examined my other MySQL database which just stored webpages and their corresponding visits and voila. Someone was able to pass values into my counters table: look: http://superhost.gr/?show=stats thats why it didn't had 1 or 2 or 3 as 'counterID' but more values were

[issue19499] import this is cached in sys.modules

2013-11-05 Thread Georg Brandl
Georg Brandl added the comment: Whatever we decide to do here, it **must** also be done for antigravity.py. -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19499 ___

[issue19502] Wrong time zone offset, when using time.strftime() with a given struct_time

2013-11-05 Thread Paweł Wroniszewski
New submission from Paweł Wroniszewski: I encountered the problem in logging module, but it is broader then that. Have a look at the following code: import time DATE_FORMAT = '%d/%b/%Y %H:%M:%S%z %Z' print(time.strftime(DATE_FORMAT)) print(time.strftime(DATE_FORMAT,time.localtime()))

[issue18345] logging: file creation options with FileHandler and friends

2013-11-05 Thread Roundup Robot
Roundup Robot added the comment: New changeset 5636366db039 by Vinay Sajip in branch '3.3': Issue #18345: Added cookbook example illustrating handler customisation. http://hg.python.org/cpython/rev/5636366db039 New changeset 388cc713ad33 by Vinay Sajip in branch 'default': Closes #18345: Merged

[issue18345] logging: file creation options with FileHandler and friends

2013-11-05 Thread Vinay Sajip
Vinay Sajip added the comment: When the online docs update, the cookbook entry should appear at http://docs.python.org/dev/howto/logging-cookbook.html#customising-handlers-with-dictconfig -- ___ Python tracker rep...@bugs.python.org

[issue2889] curses for windows (alternative patch)

2013-11-05 Thread Christoph Baumgartner
Changes by Christoph Baumgartner hydrotox...@gmail.com: -- nosy: +christoph.baumgartner ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2889 ___ ___

[issue19501] Buildbot testing of 3.2 broken

2013-11-05 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19501 ___ ___ Python-bugs-list

[issue19475] Add microsecond flag to datetime isoformat()

2013-11-05 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19475 ___ ___ Python-bugs-list

[issue15663] Investigate providing Tcl/Tk 8.5 with OS X installers

2013-11-05 Thread Roundup Robot
Roundup Robot added the comment: New changeset fc8f19b4b662 by Ned Deily in branch '2.7': Issue #15663: Revert OS X installer built-in Tcl/Tk support for 2.7.6. http://hg.python.org/cpython/rev/fc8f19b4b662 New changeset 268dc81c2527 by Ned Deily in branch '3.3': Issue #15663: Revert OS X

[issue15663] Investigate providing Tcl/Tk 8.5 with OS X installers

2013-11-05 Thread Ned Deily
Ned Deily added the comment: Due to incompatibilities with some key third-party projects as documented in Issue 19490 and the urgency of getting new maintenance releases out, the best course of action is to revert built-in Tcl/Tk support for 3.3.3 and 2.7.6. With the knowledge gained, I will

[issue19490] Problem installing matplotlib 1.3.1 with Python 2.7.6rc1 and 3.3.3rc1

2013-11-05 Thread Ned Deily
Ned Deily added the comment: After further investigation and deliberation, I believe that we need to revert the built-in Tcl/Tk from the OS X installers for 2.7.6 and 3.3.3. The contributing factors: 1. As implemented, we now know that the built-in Tcl/Tk breaks source installs and/or

[issue19503] does gc_list_merge merge properly?

2013-11-05 Thread martenjan
New submission from martenjan: The code for gc_list_merge is given in gcmodule.c. I retrieved it from http://hg.python.org/cpython/file/tip/Modules/gcmodule.c#l287 The code seems to merge list `from` incompletely: the first entry of `from` is omitted in the merged list. The issue is in line

[issue15663] Investigate providing Tcl/Tk 8.5 with OS X installers

2013-11-05 Thread Ronald Oussoren
Ronald Oussoren added the comment: I don't think you can provide a solution that's compatible with existing 3th-party extensions that use Tk and includes a private copy of Tcl/Tk. IMHO the best solution would be to provide the Tcl/Tk headers in the Python framework as well, to make it

[issue19347] PEP 453 implementation tracking issue

2013-11-05 Thread Bohuslav Slavek Kabrda
Changes by Bohuslav Slavek Kabrda bkab...@redhat.com: -- nosy: +bkabrda ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19347 ___ ___

[issue10197] subprocess.getoutput fails on win32

2013-11-05 Thread Roundup Robot
Roundup Robot added the comment: New changeset 0aa2aedc6a21 by Tim Golden in branch 'default': Issue #10197 Tweak docs for subprocess.getstatusoutput and align the documentation, the module docstring, and the function docstring. http://hg.python.org/cpython/rev/0aa2aedc6a21 --

[issue19503] does gc_list_merge merge properly?

2013-11-05 Thread Mark Dickinson
Mark Dickinson added the comment: The current code is correct. Note that `from` is the list header, and is not attached to a gc-tracked object. We want to splice the last non-header element of `to` (`to-gc.gc_prev`) to the first non-header element of `from` (`from-gc.gc_next`). Did you try

[issue19504] Change customise to customize.

2013-11-05 Thread Eric V. Smith
New submission from Eric V. Smith: The python source code usually uses customiz* (341 instances) over customis* (19 instance, 8 of which are in logging). I realize foolish consistency, and all that, but I think the documentation should all use the same conventions. I'd be happy to change the

[issue17828] More informative error handling when encoding and decoding

2013-11-05 Thread Nick Coghlan
Nick Coghlan added the comment: New and improved implementation attached that extracts the exception chaining to a helper functions and calls it only when it is the call in to the codecs machinery that failed (eliminating the need for the output flag, and covering decoding as well as

[issue17828] More informative error handling when encoding and decoding

2013-11-05 Thread Nick Coghlan
Nick Coghlan added the comment: Checking the other binary-binary and str-str codecs with input type and value restrictions: - they all throw TypeError and get wrapped appropriately when asked to encode str input (rot_13 throws the output type error) - rot_13 throws an appropriately wrapped

[issue19499] import this is cached in sys.modules

2013-11-05 Thread R. David Murray
R. David Murray added the comment: It seems to me that having import this work more than once would teach a beginner the *wrong* lesson about how python import works. So I agree that it should be a teaching moment, not a bug to be fixed. -- nosy: +r.david.murray

[issue19502] Wrong time zone offset, when using time.strftime() with a given struct_time

2013-11-05 Thread R. David Murray
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +belopolsky, r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19502 ___ ___

[issue15216] Support setting the encoding on a text stream after creation

2013-11-05 Thread Nick Coghlan
Nick Coghlan added the comment: It would be good to have this addressed in Python 3.4 (I'm following up on a few other encoding related issues at the moment). Is that a reasonable possibility before beta 1, or do we need to bump this one to 3.5? --

[issue17828] More informative error handling when encoding and decoding

2013-11-05 Thread Nick Coghlan
Nick Coghlan added the comment: Updated patch adds systematic tests for the new error handling to test_codecs.TransformTests I also moved the codecs changes up to a Codec handling improvements section. My rationale for doing that is that this is actually a pretty significant usability

[issue15663] Investigate providing Tcl/Tk 8.5 with OS X installers

2013-11-05 Thread Roundup Robot
Roundup Robot added the comment: New changeset ba31940588b6 by Ned Deily in branch '2.7': Issue #15663: Revert OS X installer built-in Tcl/Tk support for 2.7.6. http://hg.python.org/cpython/rev/ba31940588b6 -- ___ Python tracker

[issue19502] Wrong time zone offset, when using time.strftime() with a given struct_time

2013-11-05 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I cannot reproduce this and I suspect that the problem shows up only in certain times. I believe this is related to the long-standing issue that was fixed in 3.3. See issue 1667546. In Python prior to 3.3, time_struct did not store timezone

[issue19503] does gc_list_merge merge properly?

2013-11-05 Thread martenjan
martenjan added the comment: Thanks for your explanation -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19503 ___ ___ Python-bugs-list mailing

[issue19502] Wrong time zone offset, when using time.strftime() with a given struct_time

2013-11-05 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: The documentation for time.strftime(format[, t]) reads: If t is not provided, the current time as returned by localtime() is used but apparently there must be something extra going on under the hood. Yes, the C implementation uses tm_zone and tm_gmtoff

[issue19475] Add microsecond flag to datetime isoformat()

2013-11-05 Thread Alexander Belopolsky
Changes by Alexander Belopolsky alexander.belopol...@gmail.com: -- nosy: +belopolsky ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19475 ___ ___

  1   2   >