Re: problems installing library (xlsxwriter)

2017-05-31 Thread MRAB
On 2017-06-01 03:35, teni...@g.clemson.edu wrote: I've in need of using xlsxwriter. when running "pip install xlsxwriter" in my command prompt I get the following: "Requirement already satisfied: xlsxwriter in c:\programdata\anaconda3\lib\site-packages" But when running "import xlsxwriter" I g

problems installing library (xlsxwriter)

2017-05-31 Thread tenicho
I've in need of using xlsxwriter. when running "pip install xlsxwriter" in my command prompt I get the following: "Requirement already satisfied: xlsxwriter in c:\programdata\anaconda3\lib\site-packages" But when running "import xlsxwriter" I get the following: "Traceback (most recent call last

Re: Working with dictionaries and keys help please!

2017-05-31 Thread David D
Learning about dictionaries for a database possibly in the future. On Wednesday, May 31, 2017 at 8:58:39 PM UTC-4, MRAB wrote: > On 2017-06-01 01:29, David D wrote: > > I have a dictionary with a 10 people, the key being a number (0-10) and the > > value being the people's name. I am in the proc

Re: Working with dictionaries and keys help please!

2017-05-31 Thread MRAB
On 2017-06-01 01:29, David D wrote: I have a dictionary with a 10 people, the key being a number (0-10) and the value being the people's name. I am in the processing of Insert, Adding and deleting from the dictionary. All seems well until I delete a person and add a new one. The numbers (ke

Working with dictionaries and keys help please!

2017-05-31 Thread David D
I have a dictionary with a 10 people, the key being a number (0-10) and the value being the people's name. I am in the processing of Insert, Adding and deleting from the dictionary. All seems well until I delete a person and add a new one. The numbers (keys) do not change and so I am getting

Re: zeep, infinite recursion

2017-05-31 Thread Steve D'Aprano
On Tue, 30 May 2017 05:58 pm, Nagy Lc3a1szlc3b3 Zsolt wrote: >> It was easier than I thought. It seems that zeep has a problem >> processing a basic WS-Security STS (Security Token Service, plain >> username+password authentication) document. I have changed the endpoint >> URL to example.com. Tota

Re: Pandas dataframe, how to find a very specific max values?

2017-05-31 Thread zljubisic
On Tuesday, 30 May 2017 22:33:50 UTC+2, Peter Otten wrote: > z...@gmail.com wrote: > > > I have a dataframe: > > > > > > df = pd.DataFrame({ > >'x': [3,4,5,8,10,11,12,13,15,16,18,21,24,25], > >'a': [10,9,16,4,21,5,3,17,11,5,21,19,3,9] > > }) > > > > df > > Out[30]: > > a x > > 0

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Pavol Lisy
On 5/31/17, Jon Ribbens wrote: > On 2017-05-31, Pavol Lisy wrote: >> But althoug return from execute is undefined ( >> https://www.python.org/dev/peps/pep-0249/#id16 ), you could iterate >> over cursor ( https://www.python.org/dev/peps/pep-0249/#iter ) > > ... which is also optional. Thanks, I m

Re: How to make sure the result of Pandas.to_csv does not have non-ASCII code?

2017-05-31 Thread MRAB
On 2017-05-31 17:52, David Shi via Python-list wrote: How to make sure the result of Pandas.to_csv does not have non-ASCII code? Specify the encoding as 'ascii': df.to_csv(path, encoding='ascii') If there's a non-ASCII character that it can't write, it'll raise an exception. -- https://

how to change code in runtime after convert to executable file

2017-05-31 Thread Ho Yeung Lee
if keep module1.py code together with mainmodule1.exe, how to convert to executable file with py2exe in this case? after tried, it can run executable file with source code module1.py but the modified date can not be changed even if content of module1.py changed then i delete the file and change i

How to make sure the result of Pandas.to_csv does not have non-ASCII code?

2017-05-31 Thread David Shi via Python-list
How to make sure the result of Pandas.to_csv does not have non-ASCII code? Regards, David -- https://mail.python.org/mailman/listinfo/python-list

Re: Order a matrix by columns with priority

2017-05-31 Thread Peter Otten
1024m...@gmail.com wrote: > i have the following matrix: > catch = [['fc', 2, 12, 2], > ['abcd', 1, 2, 0], > ['ab', 1, 0, 0], > ['cf', 1, 13, 0], > ['fc', 1, 14, 0], > ['f', 1, 11, 0]] > > and i want this matrix to be ordered by the third columns firstly, when > the values of the third colum

Re: Circular iteration on tuple starting from a specific index

2017-05-31 Thread Beppe
Il giorno mercoledì 31 maggio 2017 00:18:40 UTC+2, guillaum...@giome.fr ha scritto: > Hi Beppe ! > > There are some powerful tools in the standard *itertools* module, you > should have a look at it :) > https://docs.python.org/3/library/itertools.html > > This is what I would do to cycle over y

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Chris Angelico
On Thu, Jun 1, 2017 at 12:27 AM, Ian Kelly wrote: > On Wed, May 31, 2017 at 8:18 AM, Chris Angelico wrote: >> Technically you CAN commit from the cursor: >> >> cur.connection.commit() > > Technically cur.connection is an optional extension. ;-) So technically, you win :) ChrisA -- https://mail

Order a matrix by columns with priority

2017-05-31 Thread 1024masi
i have the following matrix: catch = [['fc', 2, 12, 2], ['abcd', 1, 2, 0], ['ab', 1, 0, 0], ['cf', 1, 13, 0], ['fc', 1, 14, 0], ['f', 1, 11, 0]] and i want this matrix to be ordered by the third columns firstly, when the values of the third column are equals, by the second column. i just

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Jon Ribbens
On 2017-05-31, Ian Kelly wrote: > On Wed, May 31, 2017 at 4:26 AM, Jon Ribbens > wrote: >> Baloney yourself - I didn't say it was a *new* connection. In DB-API, >> a Connection is basically nothing - you can do nothing at all with it. >> A Cursor is actually what any other language would call a

Re: How to install Python package from source on Windows

2017-05-31 Thread breamoreboy
> > -Original Message- > > From: Python-list > > Sent: Tuesday, May 30, 2017 5:06 PM > > To: python-list > > Subject: Re: How to install Python package from source on Windows > > > > On Tuesday, May 30, 2017 at 11:32:46 PM UTC+1, Deborah Swanson wrote: > > > I really don't get it how all

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Ian Kelly
On Wed, May 31, 2017 at 4:26 AM, Jon Ribbens wrote: > On 2017-05-31, Ian Kelly wrote: >> On Tue, May 30, 2017 at 4:57 PM, Jon Ribbens >> wrote: >>> A DB-API "cursor" is a database connection >> >> Baloney. Creating a cursor does not spawn a new connection to the >> database. Cursors created fro

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Ian Kelly
It works just fine with every DB-API client I've used, including those which only fetch results as needed. cx_Oracle, for instance. It's not Python's fault if the underlying MySQL client interface is shitty. On Wed, May 31, 2017 at 6:29 AM, Jon Ribbens wrote: > On 2017-05-31, Peter Otten <__pete.

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Ian Kelly
On Wed, May 31, 2017 at 8:18 AM, Chris Angelico wrote: > Technically you CAN commit from the cursor: > > cur.connection.commit() Technically cur.connection is an optional extension. ;-) -- https://mail.python.org/mailman/listinfo/python-list

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Jon Ribbens
On 2017-05-31, Chris Angelico wrote: > On Thu, Jun 1, 2017 at 12:10 AM, Jon Ribbens > wrote: >> ... unless you want to call .commit() or .rollback(). >> Which is where we came in. > > Technically you CAN commit from the cursor: > > cur.connection.commit() That's an optional extension. -- https

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Jon Ribbens
On 2017-05-31, Pavol Lisy wrote: > But althoug return from execute is undefined ( > https://www.python.org/dev/peps/pep-0249/#id16 ), you could iterate > over cursor ( https://www.python.org/dev/peps/pep-0249/#iter ) ... which is also optional. -- https://mail.python.org/mailman/listinfo/python-

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Chris Angelico
On Thu, Jun 1, 2017 at 12:10 AM, Jon Ribbens wrote: > On 2017-05-31, DFS wrote: >> On 5/31/2017 6:26 AM, Jon Ribbens wrote: >>> Yes, this is indeed a problem with DB-API - you have to keep *two* >>> objects around all the time (the connection and the cursor) and pass >>> them to functions, etc, w

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Jon Ribbens
On 2017-05-31, Peter Otten <__pete...@web.de> wrote: > Jon Ribbens wrote: >> Indeed. I think this would not work, in general. For example, I think >> with MySQLdb it would work if you use a standard Cursor class, as that >> downloads the entire result set as soon as execute() is called, but it >> w

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Jon Ribbens
On 2017-05-31, DFS wrote: > On 5/31/2017 6:26 AM, Jon Ribbens wrote: >> Yes, this is indeed a problem with DB-API - you have to keep *two* >> objects around all the time (the connection and the cursor) and pass >> them to functions, etc, when in any sensible system as used by all >> other language

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Peter Otten
Jon Ribbens wrote: > On 2017-05-31, Peter Otten <__pete...@web.de> wrote: >> Jon Ribbens wrote: >>> You would do: >>> >>> cur.execute("SELECT ...") >>> for row1 in cur.fetchall(): >>> cur.execute("SELECT ...") >>> for row2 in cur.fetchall(): >>> >>> >>> a

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Pavol Lisy
On 5/31/17, Peter Otten <__pete...@web.de> wrote: > Jon Ribbens wrote: > >> On 2017-05-31, Skip Montanaro wrote: >>> I'm kind of stuck with the database API I have. ("Love the child you >>> have, not the one you wish you had?") Given that I have the choice to >>> execute those three statements to

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Jon Ribbens
On 2017-05-31, Peter Otten <__pete...@web.de> wrote: > Jon Ribbens wrote: >> You would do: >> >> cur.execute("SELECT ...") >> for row1 in cur.fetchall(): >> cur.execute("SELECT ...") >> for row2 in cur.fetchall(): >> >> >> and as far as the database is con

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Peter Otten
Jon Ribbens wrote: > On 2017-05-31, Skip Montanaro wrote: >> I'm kind of stuck with the database API I have. ("Love the child you >> have, not the one you wish you had?") Given that I have the choice to >> execute those three statements to bound a transaction, is there any >> reason not to use th

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Skip Montanaro
Well, you can't do that, because you can't iterate over an execute(). You would do: cur.execute("SELECT ...") for row1 in cur.fetchall(): cur.execute("SELECT ...") for row2 in cur.fetchall(): Whoops, yeah. I think one of the adapters at my disposal at wor

Re: zeep, infinite recursion

2017-05-31 Thread Peter Otten
Nagy László Zsolt wrote: > > >> It was easier than I thought. It seems that zeep has a problem >> processing a basic WS-Security STS (Security Token Service, plain >> username+password authentication) document. I have changed the endpoint >> URL to example.com. Total size 11K compressed. I hope

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Jon Ribbens
On 2017-05-31, Skip Montanaro wrote: > I'm kind of stuck with the database API I have. ("Love the child you > have, not the one you wish you had?") Given that I have the choice to > execute those three statements to bound a transaction, is there any > reason not to use them instead of > > (conn or

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Skip Montanaro
Let me try to gently steer the discussion back to my original question. I know that both databases I'm using support the following statements: begin transaction commit transaction rollback transaction I'm kind of stuck with the database API I have. ("Love the child you have, not the one you wish

Re: Python not able to find package but it is installed

2017-05-31 Thread Mahmood Naderan via Python-list
Consider this output [root@cluster ~]# pip --version pip 9.0.1 from /opt/rocks/lib/python2.6/site-packages/pip-9.0.1-py2.6.egg (python 2.6) [root@cluster ~]# easy_install --version distribute 0.6.10 [root@cluster ~]# find /opt -name python /opt/rocks/lib/graphviz/python /opt/rocks/bin/python /opt

Re: Python not able to find package but it is installed

2017-05-31 Thread Wolfgang Maier
On 05/30/2017 09:27 PM, Mahmood Naderan via Python-list wrote: Well yes. It looks in other folders But $ find /opt -name openpyxl /opt/rocks/lib/python2.6/site-packages/openpyxl So, your pip knows about a search path that python doesn't know. That can have a number of reasons still and one

Re: Python DB API - commit() v. execute("commit transaction")?

2017-05-31 Thread Jon Ribbens
On 2017-05-31, Ian Kelly wrote: > On Tue, May 30, 2017 at 4:57 PM, Jon Ribbens > wrote: >> A DB-API "cursor" is a database connection > > Baloney. Creating a cursor does not spawn a new connection to the > database. Cursors created from a connection share that connection. Baloney yourself - I d

Re: How to install Python package from source on Windows

2017-05-31 Thread Steven D'Aprano
I haven't been following this thread all the way through, but I just noticed this and I thought I'd comment. Deborah, my sympathies for your health issues, but I do have to point out you're in a technical community where people consider precision of language and accuracy important. If you fail