Trouble getting to windows My Documents directory

2015-07-10 Thread Mark Storkamp via Python-list
I'm just learning Python, and I've run into trouble trying to change directory to the windows My Documents directory. There's likely a better way to do this, but this is what I've tried so far: - from tkinter import Tk from tkinter.filedialog import as

Re: Trouble getting to windows My Documents directory

2015-07-10 Thread Mark Storkamp via Python-list
In article , MRAB wrote: > On 2015-07-10 15:27, Mark Storkamp via Python-list wrote: > > I'm just learning Python, and I've run into trouble trying to change > > directory to the windows My Documents directory. There's likely a better > > way to do this

Re: Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ?

2015-07-12 Thread Larry Hudson via Python-list
On 07/12/2015 05:48 AM, Simon Evans wrote: Dear Peter Otten, Yes, I have been copying and pasting, as it saves typing. I do get 'indented block' error responses as a small price > to pay for the time and energy thus saved. > You CANNOT ignore indenting. Indenting is NOT optional, it is REQUIRED

Re: Noob in Python. Problem with fairly simple test case

2015-07-15 Thread Larry Hudson via Python-list
On 07/15/2015 05:11 AM, Chris Angelico wrote: On Wed, Jul 15, 2015 at 9:44 PM, Jason P. wrote: I can't understand very well what's happening. It seems that the main thread gets blocked listening to the web server. My intent was to spawn another process for the server independent of the test.

Re: Noob in Python. Problem with fairly simple test case

2015-07-16 Thread Larry Hudson via Python-list
On 07/15/2015 08:11 PM, Chris Angelico wrote: On Thu, Jul 16, 2015 at 1:01 PM, Larry Hudson via Python-list wrote: On 07/15/2015 05:11 AM, Chris Angelico wrote: [snip] In addition to using print(), in some places I like using input() instead, as in: input('x={}, y={} --> &#

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-02 Thread Larry Hudson via Python-list
On 08/01/2015 01:34 PM, Lukas Barth wrote: Hi! I have a list of numbers that I treat as "circular", i.e. [1,2,3] and [2,3,1] should be the same. Now I want to rotate these to a well defined status, so that I can can compare them. If all elements are unique, the solution is easy: find the mini

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-03 Thread Larry Hudson via Python-list
On 08/02/2015 01:58 PM, Joonas Liik wrote: I have this feeling that you would get a lot more useful anwsers if you were to describe your actual problem in stead of what you think the solution is. There might be other, better solutions but since we know so little about what you are doing we will l

Re: Who uses IDLE -- please answer if you ever do, know, or teach

2015-08-07 Thread Larry Hudson via Python-list
On 08/05/2015 06:06 PM, Terry Reedy wrote: [snip] 0. Classes where Idle is used: Where? Level? None Idle users: 1. Are you grade school (1=12)? undergraduate (Freshman-Senior)? post-graduate (from whatever)? Some college, but didn't complete. Never had any CS or programming courses. 2. A

Re: Pipes

2015-08-10 Thread Larry Hudson via Python-list
On 08/10/2015 01:43 PM, E.D.G. wrote: [snip] It has been my experience that researchers, particularly scientists, need to have some versatile and powerful programming language available that is compatible with the Windows operating system. The language needs to make certain resources av

Mock object but also assert method calls?

2015-08-13 Thread Thomas Lehmann via Python-list
Hi, How about asserting that test2 of class Bar is called? Of course I can do a patch for a concrete method but I was looking for something like: mocked_object.assert_method_called_with(name="test2", "hello") If find following totally different to the normal API which is provided by the mock

Re: Mock object but also assert method calls?

2015-08-15 Thread Thomas Lehmann via Python-list
Am Freitag, 14. August 2015 04:53:56 UTC+2 schrieb Steven D'Aprano: > On Fri, 14 Aug 2015 07:21 am, Ben Finney wrote: > > >> If find following totally different to the normal API which > >> is provided by the mock library: > >> > >> assert call().test2("hello") in mocked_objects.mock_calls > > >

PIP does not appear to handle diacritics correctly.

2015-09-08 Thread Laszlo Lebrun via Python-list
Dear group, I do use Windows 7 and have a user name with diacritics. Whenever I am querying an extension with pip, it will fail since it does not pass on the user folder correctly. I thought PIP deals well with unicode, doesn't it? Has anyone a clue how to fix it? Thank you -- Stand up agai

Re: PIP does not appear to handle diacritics correctly.

2015-09-09 Thread Laszlo Lebrun via Python-list
On Tue, 08 Sep 2015 23:35:33 +0100, Mark Lawrence wrote: > On 08/09/2015 20:14, Laszlo Lebrun via Python-list wrote: >> >> Dear group, >> I do use Windows 7 and have a user name with diacritics. >> >> Whenever I am querying an extension with pip, it will fail sinc

Re: PIP does not appear to handle diacritics correctly.

2015-09-09 Thread Laszlo Lebrun via Python-list
On Wed, 09 Sep 2015 09:13:41 +0100, Tim Golden wrote: > On 09/09/2015 08:59, Laszlo Lebrun via Python-list wrote: >> On Tue, 08 Sep 2015 23:35:33 +0100, Mark Lawrence wrote: >> >>> On 08/09/2015 20:14, Laszlo Lebrun via Python-list wrote: >>>> >>>>

Re: PIP does not appear to handle diacritics correctly.

2015-09-09 Thread Laszlo Lebrun via Python-list
On Wed, 09 Sep 2015 00:22:31 -0700, wxjmfauth wrote: > Yes, I know how to fix all these problems. I know as well: have a user, which name is just plain ASCII. But it sucks to rebuild everything... -- Stand up against TTIP and ISDS ! -- https://mail.python.org/mailman/listinfo/python-list

Re: PIP does not appear to handle diacritics correctly.

2015-09-09 Thread Laszlo Lebrun via Python-list
On Wed, 09 Sep 2015 17:21:59 +0100, Tim Golden wrote: > On 09/09/2015 17:16, Wolfgang Maier wrote: >> On 09.09.2015 10:23, Chris Angelico wrote: >>> On Wed, Sep 9, 2015 at 5:59 PM, Laszlo Lebrun via Python-list >>> wrote: >>>> Whenever I start PIP, I get: &

Re: A little test for you Guys😜

2015-09-22 Thread Lj Fc via Python-list
On Tuesday, September 22, 2015 at 11:19:00 PM UTC+2, [email protected] wrote: > On Tuesday, September 22, 2015 at 11:45:00 AM UTC-7, Lj Fc wrote: > > you have 10 minutes😂 Good luck!! > > > > > > 1. What is PEP8 ? > > > > 2. What are the different ways to distribute some python source code ? > >

Re: Learning Modules, Arguments, Parameters (imma noob)

2015-09-24 Thread Larry Hudson via Python-list
On 09/24/2015 11:45 AM, [email protected] wrote: I seem to be having a problem understanding how arguments and parameters work, Most likely why my code will not run. Can anyone elaborate on what I am doing wrong? ''' Cody Cox 9/16/2015 Programming Exercise 1 - Kilometer Converter Design a modu

Re: Learning Modules, Arguments, Parameters (imma noob)

2015-09-25 Thread Larry Hudson via Python-list
You've already received a lot of answers and guidance, but here is on more point... On 09/25/2015 12:03 PM, Cody Cox wrote: [snip] this I am not sure about, I set Kilo=get_input(kilo), ... Watch your capitalization! Kilo is _NOT_ the same as kilo. Case is significant in Python (as wel

Re: Execute Python Scripts

2015-10-14 Thread Larry Hudson via Python-list
On 10/14/2015 10:04 AM, Cai Gengyang wrote: So I am going through this article on Python for newbies ---http://askpython.com/execute-python-scripts/ Managed to create a file with these contents : 1 #!/usr/bin/env python3 2 3 print('hello world') and saved it as hello.py You did write that f

UNABLE TO GET IDLE TO RUN

2015-10-22 Thread Terry Alexander via Python-list
Hello... I have tried installing both Python 2.7 and 3.5, and in both cases I cannot get IDLE to work. I received the following message both times: IDLE’s subprocess didn’t make connection.  Either IDLE can’t start a subprocess or personalfirewall software is blocking the connection. I am running

Fw: Python 3.5.0 (32-bit) won't install to Windows XP

2015-10-27 Thread Richard Hinerfeld via Python-list
--- On Fri, 10/23/15, Richard Hinerfeld wrote: > From: Richard Hinerfeld > Subject: Python 3.5.0 (32-bit) won't install to Windows XP > To: "[email protected]" > Date: Friday, October 23, 2015, 9:10 PM > I am > sending you the log with all the errors. > Python 3.5.0 (32-bit)_2015102321

problems using python in PowerShell

2015-10-30 Thread josephine ewers via Python-list
Hi,I am doing an online training course to learn python but when I enter 'python' in Microsoft PowerShell as I am supposed to do I always get an error message. Best regards,Josephine-- https://mail.python.org/mailman/listinfo/python-list

Re: GoPiGo script

2015-11-02 Thread Larry Hudson via Python-list
On 11/02/2015 11:31 AM, Robin Koch wrote: Am 02.11.2015 um 15:32 schrieb input/[email protected]: Thank you for the explanation for it. I must tell you that i yust beginning with python. I bought the book beginning programming with python. Have you programming experience with other langua

Re: What does “grep” stand for?

2015-11-05 Thread Larry Hudson via Python-list
On 11/05/2015 05:18 PM, Dennis Lee Bieber wrote: On Thu, 5 Nov 2015 20:19:39 + (UTC), Grant Edwards declaimed the following: Though I used a line-editor for a while on VMS, I was never very good at it, and abanded it for a full-screen editor at he first opportunity. But, if you ever get a

Re: What does “grep” stand for?

2015-11-06 Thread Larry Hudson via Python-list
On 11/06/2015 05:25 AM, William Ray Wing wrote: On Nov 5, 2015, at 10:36 PM, Larry Hudson via Python-list wrote: [snip] You’re not REALLY an old timer unless you’ve used TECO. -Bill Agreed. I'm not really and old-timer, just old (I'm 78). My first exposure to computers wa

Re: using binary in python

2015-11-09 Thread Larry Hudson via Python-list
Your questions are somewhat difficult to answer because you misunderstand binary. The key is that EVERYTHING in a computer is binary. There are NO EXCEPTIONS, it's all binary ALL the time. The difference comes about in how this binary data is displayed and manipulated. I want to emphasize, A

Re: using binary in python

2015-11-10 Thread Larry Hudson via Python-list
On 11/10/2015 12:14 PM, Dennis Lee Bieber wrote: On Mon, 9 Nov 2015 22:20:25 -0800, Larry Hudson via Python-list declaimed the following: Of course it can. The only difference a text file and a binary file is the way it's opened. Text files are opened with 'r' or 'w'

Python.exe is not a valid Win32 application error message

2015-11-11 Thread M. Kamisato via Python-list
I am running python on Windows XP SP3 and download version 3.5xx.  I got the above error message and could not run the program. I have downloaded Python version 2.7xx and it runs fine. Is there any way I can get version 3.5xx to run on my computer? Mel KamisatoBuena Park, CA -- https://mail.pytho

Re: What is wrong in this example code?

2015-11-12 Thread Larry Hudson via Python-list
On 11/12/2015 06:07 AM, fl wrote: On Thursday, November 12, 2015 at 8:58:33 AM UTC-5, fl wrote: Hi, def tick(self): """ Time will be advanced by one second """ if self.__seconds == 59: self.__seconds = 0 if (self.__minutes == 59):

Re: Question about math.pi is mutable

2015-11-13 Thread Larry Hudson via Python-list
On 11/13/2015 01:19 AM, Denis McMahon wrote: On Fri, 13 Nov 2015 09:04:54 +1100, Steven D'Aprano wrote: On Fri, 13 Nov 2015 07:40 am, Thomas 'PointedEars' Lahn wrote: [crap I expect] And you should consider the irony, and hypocrisy, of somebody who signs his posts "PointedEars" bitching a

Trouble installing Python 3.5.0

2015-11-17 Thread Robert Ziomkowski via Python-list
Hello, I installed 3.5, "successfully" as the installer indicated, yet the program wouldn't run, with the following error message: "...failed to start because api-ms-win-crt-runtime-I1-1-0.dll was not found. Re-installing the application may fix this problem." I reinstalled, but no luck. I no

Why doesn't this method have access to its "self" argument?

2015-11-19 Thread Robert Latest via Python-list
Hi all, I'm still trying to find a simple way to implement a method (but not the full class) in C. Suggestions I have recived so far are good, but seem to be over the top for such a (seemingly) simple problem. I came up with the idea of implementing the class in Python, and just setting the method

Re: how do I learn python ?

2015-11-19 Thread Mike S via Python-list
On 11/19/2015 1:00 AM, Michiel Overtoom wrote: On 18 Nov 2015, at 05:58, 夏华林 wrote: (nothing) You might want to start at https://www.python.org/about/gettingstarted/ PS. Leaving the body of an email or usenet article empty is considered bad form. Greetings, Thanks for that, there is a gr

Re: Why won't this run?

2015-11-19 Thread Mike S via Python-list
On 11/15/2015 12:38 PM, jbak36 wrote: Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. #this program says hello and asks for my name print:('Hello world!') Hello world! print:('What

Re: anyone tell me why my program will not run?

2015-11-21 Thread Larry Hudson via Python-list
On 11/20/2015 07:30 PM, Dylan Riley wrote: i am learning python and was tasked with making a program that flips a coin 100 times and then tells you the number of heads and tails. I have done so coming up with this piece of work but it doesnt run can anyone help me out? #This is credited to dy

Re: anyone tell me why my program will not run?

2015-11-22 Thread Larry Hudson via Python-list
On 11/21/2015 06:44 PM, Larry Hudson wrote: On 11/20/2015 07:30 PM, Dylan Riley wrote: i am learning python and was tasked with making a program that flips a coin 100 times and then tells you the number of heads and tails. [snip] import random heads = int("1") tails = int("2") flips = 100

Re: Python Events in 2017, Need your help.

2017-02-08 Thread Stephane Wirtel via Python-list
Thank you, with your help, we have added events on the t-shirt. Now, Could you just add them on python.org/events ? Have a nice day, Stephane On 9 Jan 2017, at 10:54, Stephane Wirtel via Python-list wrote: Dear Community, For the PythonFOSDEM [1] on 4th and 5th February in Belgium, I would

Re: Who are the "spacists"?

2017-03-19 Thread Larry Hudson via Python-list
On 03/18/2017 05:01 PM, Nathan Ernst wrote: [...] Personally, I dislike any editor that, by default, changes my input to something else. If I hit tab, I want a tab to be inserted, by default. If I want something else, I'll change the configuration. A trivial point (and irrelevant)... The thing

How to search out all Zip codes and replace with the first 2 digits, in a Pandas dataframe, with the use of regex?

2017-03-20 Thread David Shi via Python-list
Hi, there, Can anyone help? How to search out all Zip codes and replace with the first 2 digits, in a Pandas dataframe, with the use of regex? For instance, a ZIP code 33132 was found and replaced with 33. Looking forward to hearing from you. Regards. David -- https://mail.python.org/mailman/lis

Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Larry Hudson via Python-list
On 03/26/2017 01:21 AM, Νίκος Βέργος wrote: print('''UPDATE visitors SET (pagesID, host, ref, location, useros, browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE "%s"''', (pID, domain, ref, location, useros, browser, lastvisit, domain) ) prints out: UPDATE visitors SET (pag

How to make use of .egg files?

2017-04-05 Thread David Shi via Python-list
Can anyone explain please. Regards. David -- https://mail.python.org/mailman/listinfo/python-list

How to capture a CSV file and read it into a Pandas Dataframe?

2017-04-05 Thread David Shi via Python-list
I tried the following codes: import urllib2response = urllib2.urlopen('http://cordis.europa.eu/search/result_en?q=uk&format=csv')myCSV = response.read() myFile = pd.read_csv(myCSV) but, it did not work well. Can any one help? Regards. David -- https://mail.python.org/mailman/listinfo/python-l

Re: How to capture a CSV file and read it into a Pandas Dataframe?

2017-04-05 Thread David Shi via Python-list
there a way to capture the file? Regards. David On Wednesday, 5 April 2017, 17:19, Skip Montanaro wrote: I'm not positive, but try passing response to read_csv() instead of reading the bytes yourself. Skip On Apr 5, 2017 10:38 AM, "David Shi via Python-list" wrote:

[no subject]

2017-04-07 Thread David Shi via Python-list
I was using IPython notebooks.  All the sudden, it asks for password or token. I did not set any password or token. How do I get back to use my IPython notebooks? Looking forward to hearing from you. Regards. David -- https://mail.python.org/mailman/listinfo/python-list

A Python solution for turning a web page into Pandas DataFrame table

2017-04-07 Thread David Shi via Python-list
Is there a Python solution for turning a web page into Pandas DataFrame table? Looking forward to hearing from you. Regards. David -- https://mail.python.org/mailman/listinfo/python-list

Pound sign problem

2017-04-10 Thread David Shi via Python-list
In the data set, pound sign escape appears: u'price_currency': u'\xa3', u'price_formatted': u'\xa3525,000', When using table.to_csv after importing pandas as pd, an error message persists as follows: UnicodeEncodeError: 'ascii' codec can't encode character u'\xa3' in position 0: ordinal not in ra

XML tree to a pandas dataframe

2017-04-12 Thread David Shi via Python-list
What is the best way to convert XML document into a pandas dataframe? Regards. David -- https://mail.python.org/mailman/listinfo/python-list

How to pd.read_csv into a DataFrame with multiple seperators?

2017-04-12 Thread David Shi via Python-list
Have a look at this example. http://www.ebi.ac.uk/ena/data/warehouse/search?query=%22geo_circ(-0.587,-90.5713,170)%22&result=sequence_release&display=text How to pd.read_csv into a DataFrame with multiple seperators? Regards. David -- https://mail.python.org/mailman/listinfo/python-list

Read a text file into a Pandas DataFrame Table

2017-04-13 Thread David Shi via Python-list
Dear All, Can anyone help to read a text file into a Pandas DataFrame Table? Please see the link below. http://www.ebi.ac.uk/ena/data/warehouse/search?query=%22geo_circ(-0.587,-90.5713,170)%22&result=sequence_release&display=text Regards. David -- https://mail.python.org/mailman/listinfo/python-l

Reading structured text file (non-CSV) into Pandas Dataframe

2017-04-13 Thread David Shi via Python-list
http://www.ebi.ac.uk/ena/data/warehouse/search?query=%22geo_circ(-0.587,-90.5713,170)%22&result=sequence_release&display=text The above is a web link to a structured text file.  It is not a CSV. How can this text file be read into a Pandas Dataframe, so that further processing can be made? Looking

[no subject]

2017-04-13 Thread David Shi via Python-list
13.1. csv — CSV File Reading and Writing — Python 2.7.13 documentation | | | 13.1. csv — CSV File Reading and Writing — Python 2.7.13 documentation | | | I am trying to parse this text file into a table. How to use consecutive 3 spaces to work as delimiter with csv.reader? Looking f

[no subject]

2017-04-13 Thread David Shi via Python-list
Which VCF reader has been well tested and proven to be robust? Looking forward to hearing from you. Regards. David -- https://mail.python.org/mailman/listinfo/python-list

How to do pd.read_csv with consecutive spaces or semi-colon as delimiters?

2017-04-18 Thread David Shi via Python-list
Any way to do that? The link to a sample dataset is as follows: http://www.ebi.ac.uk/ena/data/warehouse/search?query=%22geo_circ(-0.587,-90.5713,170)%22&result=sequence_release&display=text Looking forward to hearing from you. Regards. David -- https://mail.python.org/mailman/listinfo/python-lis

Pressing dot and show sub command in IPython

2017-04-18 Thread David Shi via Python-list
Hi, Matt, How to make IPython work more interactively? As I remember, pressing dot and sub command shows up suggestively in IPython. But, now, after re-installing IPython notebook, it does not do so any more. Looking forward to hearing from you. Regards. David -- https://mail.python.org/mailman/li

Turtle window not closing

2017-04-21 Thread Harshika Varadhan via Python-list
Hi everyone, I am creating a game where the user inputs a coordinate to place their piece on a chess board. My code then draws the chess board with a turtle and fills in the squares in with green where the user can place their next piece. After the user inputs their first coordinate, the turtle

Re: Turtle window not closing

2017-04-22 Thread Harshika Varadhan via Python-list
n Saturday, April 22, 2017 3:56 AM, Peter Otten <[email protected]> wrote: Harshika Varadhan via Python-list wrote: > I am creating a game where the user inputs a coordinate to place their > piece on a chess board. My code then draws the chess board with a turtle > and fills in

Re: Rosetta: Sequence of non-squares

2017-05-02 Thread Mark Summerfield via Python-list
On Monday, May 1, 2017 at 9:47:10 PM UTC+1, [email protected] wrote: > On Monday, May 1, 2017 at 11:27:01 AM UTC-7, Robert L. wrote: > [no Python] > > Do you ever plan to ask any questions about Python? Or are you just using a > few lines of code as a fig leaf for the race baiting that you post in

Install python via MS batch file

2017-05-06 Thread Mahmood Naderan via Python-list
Hello, I have downloaded python-3.6.1-amd64.exe and it is fine to install it through GUI. However, I want to write a batch file to install it via command line. Since the installation process is interactive, it seems that the auto-install batch file is difficult. What I want to do is: set python

ANN: distlib 0.2.5 released on PyPI

2017-05-06 Thread Vinay Sajip via Python-list
I've just released version 0.2.5 of distlib on PyPI [1]. For newcomers, distlib is a library of packaging functionality which is intended to be usable as the basis for third-party packaging tools. The main changes in this release are as follows: * Changed regular expressions to be compatible with

packaging python code

2017-05-08 Thread Mahmood Naderan via Python-list
Hi, I have simple piece of code which uses two libraries (numpy and openpyxl). The script is called from another application. Currently, if someone wants to run my program, he has to first install the python completely via its installer. Is there any way to pack my .py with all required librarie

Re: packaging python code

2017-05-08 Thread Mahmood Naderan via Python-list
OK. I did that but it fails! Please see the stack D:\ThinkPad\Documents\NetBeansProjects\ExcelTest>pyinstaller exread.py 96 INFO: PyInstaller: 3.2.1 96 INFO: Python: 3.6.1 98 INFO: Platform: Windows-10-10.0.14393-SP0 103 INFO: wrote D:\ThinkPad\Documents\NetBeansProjects\ExcelTest\exread.spec

Out of memory while reading excel file

2017-05-10 Thread Mahmood Naderan via Python-list
Hello, The following code which uses openpyxl and numpy, fails to read large Excel (xlsx) files. The file si 20Mb which contains 100K rows and 50 columns. W = load_workbook(fname, read_only = True) p = W.worksheets[0] a=[] m = p.max_row n = p.max_column np.array([[i.value for i in j] for

Re: Out of memory while reading excel file

2017-05-10 Thread Mahmood Naderan via Python-list
, May 10, 2017 7:25 PM, Peter Otten <[email protected]> wrote: Mahmood Naderan via Python-list wrote: > Hello, > > The following code which uses openpyxl and numpy, fails to read large > Excel (xlsx) files. The file si 20Mb which contains 100K rows and 50 > colu

Re: Out of memory while reading excel file

2017-05-10 Thread Mahmood Naderan via Python-list
[email protected] Date: Wednesday, May 10, 2017, 3:48 PM Mahmood Naderan via Python-list wrote: > Thanks for your reply. The openpyxl part (reading the workbook) works > fine. I printed some debug information and found that when it reaches the > np.array, after some 10 seconds, t

Re: Out of memory while reading excel file

2017-05-10 Thread Mahmood Naderan via Python-list
On Wed, 5/10/17, Peter Otten <[email protected]> wrote: Subject: Re: Out of memory while reading excel file To: [email protected] Date: Wednesday, May 10, 2017, 6:30 PM Mahmood Naderan via Python-list wrote: > Well actually cells are treated as strings and not integer

Re: Out of memory while reading excel file

2017-05-10 Thread Mahmood Naderan via Python-list
Hi, I am confused with that. If you say that numpy is not suitable for my case and may have large overhead, what is the alternative then? Do you mean that numpy is a good choice here while we can reduce its overhead? Regards, Mahmood -- https://mail.python.org/mailman/listinfo/python-list

Re: Out of memory while reading excel file

2017-05-10 Thread Mahmood Naderan via Python-list
>a = numpy.zeros((ws.max_row, ws.max_column), dtype=float) >for y, row in enumerate(ws.rows): > a[y] = [cell.value for cell in row] Peter, As I used this code, it gave me an error that cannot convert string to float for the first cell. All cells are strings. Regards, Mahmood -- https://

Re: Out of memory while reading excel file

2017-05-10 Thread Mahmood Naderan via Python-list
Hi, I used the old fashion coding style to create a matrix and read/add the cells. W = load_workbook(fname, read_only = True) p = W.worksheets[0] m = p.max_row n = p.max_column arr = np.empty((m, n), dtype=object) for r in range(1, m): for c in range(1, n): d = p.cell(row=r, colu

Re: Out of memory while reading excel file

2017-05-11 Thread Mahmood Naderan via Python-list
I wrote this: a = np.zeros((p.max_row, p.max_column), dtype=object) for y, row in enumerate(p.rows): for cell in row: print (cell.value) a[y] = cell.value print (a[y]) For one of the cells, I see NM_198576.3 ['NM_198576.3' 'NM_198576.3' 'NM_198576.3' 'NM_1985

Re: Why am I getting a 'sqlite3.OperationalError'?

2017-05-11 Thread Mark Summerfield via Python-list
The ? is indeed for variable substitution, but AFAIK only for field values, not for table names, which is why your first example doesn't work and your second and third examples do work. -- https://mail.python.org/mailman/listinfo/python-list

Re: Out of memory while reading excel file

2017-05-11 Thread Mahmood Naderan via Python-list
Thanks. That code is so simple and works. However, there are things to be considered. With the CSV format, cells in a row are separated by ',' and for some cells it writes "" around the cell content. So, if the excel looks like CHR1 11,232,445 The output file looks like CHR1,"11,232,4

Re: Out of memory while reading excel file

2017-05-11 Thread Mahmood Naderan via Python-list
Excuse me, I changed csv.writer(outstream) to csv.writer(outstream, delimiter =' ') It puts space between cells and omits "" around some content. However, between two lines there is a new empty line. In other word, the first line is the first row of excel file. The second line is empty ("\

Re: Out of memory while reading excel file

2017-05-11 Thread Mahmood Naderan via Python-list
Thanks a lot for suggestions. It is now solved. Regards, Mahmood -- https://mail.python.org/mailman/listinfo/python-list

Re: How to install Python package from source on Windows

2017-05-16 Thread Mark Summerfield via Python-list
I think the problem that Deborah has encountered is a more general one on Windows: many pip-installable packages assume that a C compiler is available. Now an "obvious" solution is for pip to recognise that a C compiler is needed and give an appropriate error message. But while that may reduce con

Re: Finding sentinel text when using a thread pool...

2017-05-20 Thread Christopher Reimer via Python-list
On 5/20/2017 1:19 AM, dieter wrote: If your (590) pages are linked together (such that you must fetch a page to get the following one) and page fetching is the limiting factor, then this would limit the parallelizability. The pages are not linked together. The URL requires a page number. If I

Concatenating files in order

2017-05-23 Thread Mahmood Naderan via Python-list
Hi, There are some text files ending with _chunk_i where 'i' is an integer. For example, XXX_chunk_0 XXX_chunk_1 ... I want to concatenate them in order. Thing is that the total number of files may be variable. Therefore, I can not specify the number in my python script. It has to be "for all

Re: Concatenating files in order

2017-05-23 Thread Mahmood Naderan via Python-list
>Yup. Make a list of all the file names, write a key function that >extracts the numbery bits, sort the list based on that key function, and >go to town. > >Alternatively, when you create the files in the first place, make sure >to use more leading zeros than you could possibly need. >xxx_chun

Re: Concatenating files in order

2017-05-23 Thread Mahmood Naderan via Python-list
OK guys thank you very much. It is better to sort them first. Here is what I wrote files = glob.glob('*chunk*') sorted=[[int(name.split("_")[-1]), name] for name in files] with open('final.txt', 'w') as outf: for fname in sorted: with open(fname[1]) as inf: for line in

Re: Concatenating files in order

2017-05-25 Thread Mahmood Naderan via Python-list
Hi guys, Cameron, thanks for the points. In fact the file name contains multiple '_' characters. So, I appreciate what you recommended. filenames = {} for name in glob.glob('*chunk_*'): left, right = name.rsplit('_', 1) if left.endswith('chunk') and right.isdigit(): fi

Re: Concatenating files in order

2017-05-26 Thread Mahmood Naderan via Python-list
Thank you very much. I understand that Regards, Mahmood On Friday, May 26, 2017 5:01 AM, Cameron Simpson wrote: On 25May2017 20:37, Mahmood Naderan wrote: >Cameron, thanks for the points. In fact the file name contains multiple '_' >characters. So, I appreciate what you recommended. > >

Re: Verifiably better, validated Enum for Python

2017-05-26 Thread Larry Hudson via Python-list
On 05/26/2017 04:46 AM, Steve D'Aprano wrote: [snip..]> That's not how the C standard defines "undefined behaviour", or the implication of such. A little OT here, but... This brings to mind this entry in the Jargon File: http://catb.org/jargon/html/N/nasal-demons.html -- -=- Larry -=- -

embed a package for proper fun script

2017-05-29 Thread Mahmood Naderan via Python-list
Hello, How it is possible to embed a package in my project? I mean, in my python script I have written import openpyxl So, the user may not have installed that package and doesn't understand what is pip! Please let me know the instructions or any document regarding that. Regards, Mahmood --

Re: embed a package for proper fun script

2017-05-30 Thread Mahmood Naderan via Python-list
No idea?... Regards, Mahmood On Tuesday, May 30, 2017 1:06 AM, Mahmood Naderan via Python-list wrote: Hello, How it is possible to embed a package in my project? I mean, in my python script I have written import openpyxl So, the user may not have installed that package and doesn&#

Python not able to find package but it is installed

2017-05-30 Thread Mahmood Naderan via Python-list
Hello, Although I have installed a package via pip on a centos-6.6, python interpreter still says there is no such package! Please see the output below $ python exread2.py input.xlsx tmp/output Traceback (most recent call last): File "/home/mahmood/excetest/exread2.py", line 1, in from openpyxl

Re: embed a package for proper fun script

2017-05-30 Thread Mahmood Naderan via Python-list
AM, Mahmood Naderan via Python-list > wrote: > > > > Hello, > > How it is possible to embed a package in my project? I mean, in my python > script I have written > > > import openpyxl > > > So, the user may not have installed that packag

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

2017-05-30 Thread Mahmood Naderan via Python-list
Well, on rocks there exist multiple pythons. But by default the active is 2.6.6 $ python -V Python 2.6.6 I have to say that the script doesn't modify sys.path. I only use sys.argv[] there I can put all dependent modules in my project folder but that will be dirty. Regards, Mahmood On Tues

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

2017-05-30 Thread Mahmood Naderan via Python-list
Well yes. It looks in other folders >>> import openpyxl # trying openpyxl.so # trying openpyxlmodule.so # trying openpyxl.py # trying openpyxl.pyc # trying /usr/lib64/python2.6/openpyxl.so # trying /usr/lib64/python2.6/openpyxlmodule.so # trying /usr/lib64/python2.6/openpyxl.py # trying /usr/lib64

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

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: Is An Element of a Sequence an Object?

2017-06-04 Thread Larry Hudson via Python-list
On 06/03/2017 09:39 PM, Chris Angelico wrote: That's a tricky thing to pin down. Since it's possible for a sequence to contain itself, or to contain something which contains it, Like a Tardis? [Sorry, couldn't resist...] ;-) OTOH, On-Topic... It might be worth while to point out that a 'ch

openpyxl reads cell with format

2017-06-05 Thread Mahmood Naderan via Python-list
Hello guys... With openpyxl, it seems that when the content of a cell is something like "4-Feb", then it is read as "2016-02-04 00:00:00" that looks like a calendar conversion. How can I read the cell as text instead of such an automatic conversion? Regards, Mahmood -- https://mail.python.org/

Openpyxl cell format

2017-06-05 Thread Mahmood Naderan via Python-list
Hello guys, With openpyxl, it seems that when the content of a cell is something like "4-Feb", then it is read as "2016-02-04 00:00:00" that looks like a calendar conversion. How can I read the cell as text instead of such an automatic conversion? Regards, Mahmood -- https://mail.python.org/m

Re: Openpyxl cell format

2017-06-05 Thread Mahmood Naderan via Python-list
Maybe... But specifically in my case, the excel file is exported from a web page. I think there should be a way to read the content as a pure text. Regards, Mahmood -- https://mail.python.org/mailman/listinfo/python-list

Re: openpyxl reads cell with format

2017-06-05 Thread Mahmood Naderan via Python-list
>if the cell is an Excel date, it IS stored as a numeric As I said, the "shape" of the cell is similar to date. The content which is "4-Feb" is not a date. It is a string which I expect from cell.value to read it as "4-Feb" and nothing else. Also, I said before that the file is downloaded from

Re: openpyxl reads cell with format

2017-06-05 Thread Mahmood Naderan via Python-list
OK thank you very much. As you said, it seems that it is too late for my python script. Regards, Mahmood On Monday, June 5, 2017 10:41 PM, Dennis Lee Bieber wrote: On Mon, 5 Jun 2017 14:46:18 + (UTC), Mahmood Naderan via Python-list declaimed the following: >>if the cell

Re: Error in initialization of IDLE.

2017-06-07 Thread Mohit Soni via Python-list
Sent from Yahoo Mail on Android I have python 3.5.2 installed and recently I installed python 3.6 and after installing the problem seems to occur. Whenever I start IDLE it shows an error message like "IDLE can't create a sub process or windows firewall might be blocking it" I did a fresh inst

Re: sqlite3 is non-transactional??

2017-06-15 Thread Mark Summerfield via Python-list
On Thursday, June 15, 2017 at 9:50:18 AM UTC+1, Michele Simionato wrote: > Thanks. I suspected the culprit was executescript, but I did not see it > documented in > https://docs.python.org/3/library/sqlite3.html#connection-objects. Although the standard library's sqlite3 module is useful, person

Re: sqlite in 2.7 on redhat 6

2017-06-15 Thread Mark Summerfield via Python-list
On Thursday, June 15, 2017 at 1:47:00 PM UTC+1, [email protected] wrote: > I am trying to use sqlite > > $ python2.7 > Python 2.7.10 (default, Feb 22 2016, 12:13:36) > [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>

course

2017-06-19 Thread Val Krem via Python-list
Hi all, Is there on line course in Python? I am looking for a level between beginner and intermediate. I would appreciate if you could suggest me? Thank you. -- https://mail.python.org/mailman/listinfo/python-list

<    45   46   47   48   49   50   51   52   53   54   >