Re: Do I need a parser?

2019-06-29 Thread Alan Meyer via Python-list
On 6/29/19 8:39 AM, josé mariano wrote: Dear all, I'm sure that this subject has been addressed many times before on this forum, but my poor knowledge of English and of computer jargon and concepts results on not being able to find the answer i'm looking for when I search the forum. So here i

Re: Handle foreign character web input

2019-06-29 Thread Alan Meyer via Python-list
On 6/28/19 4:25 PM, Tobiah wrote: A guy comes in and enters his last name as RÖnngren. So what did the browser really give me; is it encoded in some way, like latin-1?  Does it depend on whether the name was cut and pasted from a Word doc. etc? Should I handle these internally as unicode?  Right

Re: Installling ADODB on an offline computer

2015-01-30 Thread Alan Meyer
On 01/30/2015 09:45 AM, bkl...@rksystems.com wrote: On Thursday, January 29, 2015 at 8:35:50 PM UTC-5, Alan Meyer wrote: I work on an application that uses the ActivePython compilation of Python from ActiveState. It uses three Microsoft COM libraries that are needed for talking to SQL Server

Installling ADODB on an offline computer

2015-01-29 Thread Alan Meyer
I work on an application that uses the ActivePython compilation of Python from ActiveState. It uses three Microsoft COM libraries that are needed for talking to SQL Server. The libraries are: Microsoft Activex Data Objects Microsoft Activex Data Objects Recordset Microsoft ADO Ext

Re: running python 2 vs 3

2014-03-20 Thread Alan Meyer
On 3/20/2014 11:21 AM, Marko Rauhamaa wrote: On a linux box, the initial line of the script indicates the interpreter: #!/usr/bin/env python2 for Python 2.x #!/usr/bin/env python3 for Python 3.x. All tutorials will tell you to start it with #!/usr/bin/env python which will sta

Re: Python programming

2014-02-11 Thread Alan Meyer
On 2/11/2014 7:21 PM, ngangsia akumbo wrote: > Please i have a silly question to ask. > > How long did it take you to learn how to write programs? > > What is the best way i can master thinker? > I know the syntax but using it to write a program is a problem Here's one way to learn: Start with

Re: Cannot run a single MySQLdb execute....

2013-03-29 Thread Alan Meyer
On 03/29/2013 01:32 PM, Alan Meyer wrote: However, MySQLdb is a well established module and what you're asking it to do is very simple and very standard. Oh, sorry, I see that you already said that mysqldb won't work with python 3. My comments in the last message are irrelevan

Re: Cannot run a single MySQLdb execute....

2013-03-29 Thread Alan Meyer
On 03/29/2013 03:40 AM, Νίκος Γκρ33κ wrote: ... So, just to make sure that MySQLdb isnt causeing the probkem can someone, perhaps you that is familiar with linxu conenct to my jailed shell account and install manually the 'pymysql' module because i dont know how to do it and i cannot afford to pa

Re: Cannot run a single MySQLdb execute....

2013-03-28 Thread Alan Meyer
On 3/27/2013 11:50 PM, Νίκος Γκρ33κ wrote: I'am about to go nuts with python 3.2.3 Do you see somehtign wrong with the following statement? cur.execute( '''SELECT hits FROM counters WHERE url = ?''', (page,) ) data = cur.fetchone() because as you can see by visiting my webpage at http://superh

Re: 10 sec poll - please reply!

2012-11-20 Thread Alan Meyer
On 11/20/2012 11:29 AM, mherrmann...@gmail.com wrote: > ... generate_keystrokes? ... Not bad. "gen_keystrokes", or even "keystrokes" might also do. I suggest using a name that is unique enough that you can grep through piles of code and find where it's used. "type" fails that test. "genera

Re: Does py2app improves speed?

2011-11-28 Thread Alan Meyer
On 11/24/2011 9:27 AM, Dave Angel wrote: ... Several ways to speed up code. 1) use language features to best advantage 2) use 3rd party libraries that do certain things well 3) use best algorithms, subject to #1 and #2 4) have someone else review the code (perhaps on the list, perhaps within you

Re: suitability of python

2011-11-24 Thread Alan Meyer
On 11/24/2011 07:31 AM, Rudra Banerjee wrote: Dear friends, I am a newbie in python and basically i use python for postprocessing like plotting, data manipulation etc. Based on ease of programming on python I am wondering if I can consider it for the main development as well. My jobs (written on

Re: What I do and do not know about installing Python on Win 7 with regard to IDLE.

2011-11-23 Thread Alan Meyer
On 11/23/2011 12:38 PM, W. eWatson wrote: So unless Alan Meyer has further interest in this, it looks like it's at an end. It may be time to move on to c++. C++ is a ton of fun. You haven't lived until you've made a syntax error in a template instantiation and seen a hu

Re: What I do and do not know about installing Python on Win 7 with regard to IDLE.

2011-11-22 Thread Alan Meyer
On 11/22/2011 3:05 PM, Dennis Lee Bieber wrote: On Tue, 22 Nov 2011 14:29:18 -0500, Alan Meyer declaimed the following in gmane.comp.python.general: On 11/22/2011 1:55 PM, Alan Meyer wrote: ... 6. Select, or navigate to and select, the python IDLE interpreter. ... On my system that's

Re: What I do and do not know about installing Python on Win 7 with regard to IDLE.

2011-11-22 Thread Alan Meyer
On 11/22/2011 1:55 PM, Alan Meyer wrote: ... 6. Select, or navigate to and select, the python IDLE interpreter. ... On my system that's C:\Python26\Lib\site-packages\pythonwin\Pythonwin.exe Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: What I do and do not know about installing Python on Win 7 with regard to IDLE.

2011-11-22 Thread Alan Meyer
On 11/21/2011 11:39 AM, W. eWatson wrote: My criterion for success is that it puts IDLE as a choice for editor on the menu produced with a right-click on a py file. So far no response on this has solved the problem. ... I don't know what responses you're referring to since this is the first

Re: Using the Python Interpreter as a Reference

2011-11-22 Thread Alan Meyer
On 11/20/2011 7:46 PM, Travis Parks wrote: Hello: I am currently working on designing a new programming language. ... I have great respect for people who take on projects like this. Your chances of popularizing the language are small. There must be thousands of projects like this for every

Re: Both Python 2.5.2 and 2.7.2 flop the same way under Win 7

2011-11-21 Thread Alan Meyer
On 11/17/2011 3:43 PM, Chris Angelico wrote: ... If you're having issues, grab a spare computer, throw Linux on it (I recommend Ubuntu or Debian, others will have other preferred distros), and see if the issues remain. Or if you're having trouble with the GUI, try things from the command line (Wi

Re: (don't bash me too hard) Python interpreter in JavaScript

2011-11-15 Thread Alan Meyer
On 11/15/2011 3:37 PM, Passiday wrote: Hello, I am looking for a way how to bring Python interpreter to JavaScript, in order to provide a web-based application with python scripting capabilities. The app would have basic IDE for writing and debugging the python code, but the interpretation, o

Re: suppressing import errors

2011-11-15 Thread Alan Meyer
On 11/15/2011 4:20 PM, David Riley wrote: ... None was set to some other value. The other value might have a type (such as a container) that could be false in a boolean context! Obviously, that last bit doesn't apply to modules; they're not going to evaluate as False in general.

Re: How to isolate a constant?

2011-10-25 Thread Alan Meyer
On 10/22/2011 8:46 PM, MRAB wrote: On 23/10/2011 01:26, Gnarlodious wrote: Say this: class tester(): _someList = [0, 1] def __call__(self): someList = self._someList someList += "X" return someList test = tester() But guess what, every call adds to the variable that I am trying to copy each t

Re: how to call java methods in python

2011-10-04 Thread Alan Meyer
On 10/4/2011 2:39 AM, masood shaik wrote: Hi I am trying to import java method in python. But i am getting the following error. error: ImportError: No module named Calculator Calculator is the name of the class written in java. I am trying to access the methods of that class. Plea

Re: Is it possible to create C-style "main" function in Python? (for teaching purposes)

2011-10-04 Thread Alan Meyer
On 10/4/2011 9:07 PM, Alan Meyer wrote: ... and to write up a comparison of the pros and cons of the global and no-global approaches. ... Of course you'll need to be fair in evaluating the students comparisons. Some bright students are likely to come up with good reasons for using gl

Re: Need A script to open a excel file and extract the data using autofilter

2011-10-04 Thread Alan Meyer
On 10/4/2011 5:12 PM, David Monaghan wrote: On Tue, 04 Oct 2011 19:42:06 +0100, Chris Withers wrote: On 01/10/2011 23:00, David Monaghan wrote: after opening the text.xls file i need to filter all the rows in which the status column is passed and copy the whole sheet to another sheet I don't

Re: Is it possible to create C-style "main" function in Python? (for teaching purposes)

2011-10-04 Thread Alan Meyer
On 10/3/2011 12:26 PM, Alec Taylor wrote: ... On Tue, Oct 4, 2011 at 3:21 AM, Aivar Annamaa wrote: ... I'm looking for a trick or hidden feature to make Python 3 automatically call a "main" function but without programmers writing `if __name__ == "__main__": ...` ... Here's why I want such a

Re: Another win for profiling.

2011-07-29 Thread Alan Meyer
On 07/29/2011 07:46 AM, Roy Smith wrote: It's often said that you shouldn't try to guess what's slow, but use profiling tools to measure what's slow. I had a great example of that yesterday. ... Yes. My first experience of profiling was about 25 years ago. I was experimenting with Borland'

Re: Only Bytecode, No .py Files

2011-07-29 Thread Alan Meyer
On 07/26/2011 11:19 AM, Eldon Ziegler wrote: Is there a way to have the Python processor look only for bytecode files, not .py files? We are seeing huge numbers of Linux audit messages on production system on which only bytecode files are stored. The audit subsystem is recording each open failure

Re: list comprehension to do os.path.split_all ?

2011-07-28 Thread Alan Meyer
On 7/28/2011 4:18 PM, gry wrote: [python 2.7] I have a (linux) pathname that I'd like to split completely into a list of components, e.g.: '/home/gyoung/hacks/pathhack/foo.py' --> ['home', 'gyoung', 'hacks', 'pathhack', 'foo.py'] os.path.split gives me a tuple of dirname,basename, but the

Re: Composition instead of inheritance

2011-05-02 Thread Alan Meyer
On 4/28/2011 1:15 PM, Ethan Furman wrote: For anybody interested in composition instead of multiple inheritance, I have posted this recipe on ActiveState (for python 2.6/7, not 3.x): http://code.activestate.com/recipes/577658-composition-of-classes-instead-of-multiple-inherit/ Comments welcome

Re: Looking for Remote Python Project

2011-01-31 Thread Alan Meyer
On 01/29/2011 04:19 PM, joy99 wrote: Dear Room, I am a Python Programmer from India(New Delhi Region), and I worked for quite a long time in Bangalore. I have been working in Python for the last 4 years or so. I have successfully built around 15 projects in Python. I am looking for some remote P

Re: how to read the last line of a huge file???

2011-01-31 Thread Alan Meyer
On 01/26/2011 04:22 PM, MRAB wrote: On 26/01/2011 10:59, Xavier Heruacles wrote: I have do some log processing which is usually huge. The length of each line is variable. How can I get the last line?? Don't tell me to use readlines or something like linecache... Seek to somewhere near the end

Re: Swampy Module installation

2011-01-24 Thread Alan Meyer
On 01/18/2011 06:26 PM, Michael Rauh wrote: I am new to python, and attempting to install the learning module swampy. http://www.greenteapress.com/thinkpython/swampy/install.html Unfortunately, I am attempting to do this on windows vista, which does not appear to be cooperating. Once I click on t

Re: String to char and decimal number conversion

2011-01-10 Thread Alan Meyer
On 1/10/2011 6:02 PM, Chris Rebert wrote: On Mon, Jan 10, 2011 at 2:44 PM, SANKAR . wrote: Hello There, I am from non IT field also new to python programming.Could you please help me to solve the following problem? I have a list T1 with following format: T1 = [ ' "Field" ' , ' "12.5"

Re: Trying to decide between PHP and Python

2011-01-06 Thread Alan Meyer
On 1/5/2011 10:30 AM, Grant Edwards wrote: 1) How often is a compiler for language X written? 2) How often is source code written in language X? 3) How often is that source code in language X read/modified? If you compare those numbers you'll realize that optimizing for case 1 at the ex

Re: Trying to decide between PHP and Python

2011-01-06 Thread Alan Meyer
On 1/5/2011 11:40 AM, Tomasz Rola wrote: On Tue, 4 Jan 2011, Roy Smith wrote: There. Now that I've tossed some gasoline on the language wars fire, I'll duck and run in the other direction :-) May I suggest a better strategy? Run first, duck next :-). Or more precisely: ((run) duck) Al

Re: PEP: possibility of inline using of a symbol instead of "import"

2011-01-06 Thread Alan Meyer
On 1/6/2011 10:28 AM, dmitrey wrote: > hi all, > I have th PEP (I'm not sure something like that hadn't been proposed > although): > very often in a Python file header the following lines are present, > like: > from MyModule1 import myFunc1 > import MyModule2 as mm2 > from MyModule3 import myFunc3

Re: Problem inserting an element where I want it using lxml

2011-01-05 Thread Alan Meyer
On 01/05/2011 01:16 AM, Josh English wrote: Here's a trimmed down version of how I did this (using ElementTree standalone, but the API should be the same) This is from a class definition and the _elem attribute is a link to an ElementTree.Element object. ... def _add_elem(self, tagName, t

Re: Problem inserting an element where I want it using lxml

2011-01-05 Thread Alan Meyer
On 01/05/2011 02:47 AM, Stefan Behnel wrote: ... Looks trivial to me. ;) ... ".iter()" gives you a recursive iterator that will also yield the "something" Element in your case, thus the incorrect counting. You only want the children, so you should iterate over the Element itself. Thanks Stepha

Problem inserting an element where I want it using lxml

2011-01-04 Thread Alan Meyer
I'm having some trouble inserting elements where I want them using the lxml ElementTree (Python 2.6). I presume I'm making some wrong assumptions about how lxml works and I'm hoping someone can clue me in. I want to process an xml document as follows: For every occurrence of a particular elemen

Re: Trying to decide between PHP and Python

2011-01-04 Thread Alan Meyer
On 1/4/2011 4:22 PM, Google Poster wrote: The syntax reminds me of Lots of Interspersed Silly Parentheses (L.I.S.P.), but without the parentheses. I haven't heard that version before. The one I heard was: "Lots of Irritating Single Parentheses". Alan -- http://mail.python.org/mailman/lis

Re: Trying to decide between PHP and Python

2011-01-04 Thread Alan Meyer
I confess that I haven't used php so someone correct me if I'm wrong. Looking at the history of the two languages, it is my impression that php originated as a language for web/CGI development which eventually added features enabling it to be used (sparingly) as a general purpose language. Py

Re: Trying to parse a HUGE(1gb) xml file

2010-12-27 Thread Alan Meyer
By the way Stefan, please don't take any of my comments as complaints. I use lxml more and more in my work. It's fast, functional and pretty elegant. I've written a lot of code on a lot of projects in my 35 year career but I don't think I've written anything anywhere near as useful to anywher

Re: Trying to parse a HUGE(1gb) xml file

2010-12-27 Thread Alan Meyer
On 12/27/2010 6:21 PM, Roy Smith wrote: ... In the old days, they used to say, "Nobody ever got fired for buying IBM". Relational databases have pretty much gotten to that point That's _exactly_ the comparison I had in mind too. I once worked for a company that made a pitch to a big pot

Re: Trying to parse a HUGE(1gb) xml file

2010-12-27 Thread Alan Meyer
On 12/27/2010 4:55 PM, Stefan Behnel wrote: ... From my experience, SAX is only practical for very simple cases where little state is involved when extracting information from the parse events. A typical example is gathering statistics based on single tags - not a very common use case. Anything

Re: Trying to parse a HUGE(1gb) xml file

2010-12-27 Thread Alan Meyer
On 12/26/2010 3:15 PM, Tim Harig wrote: ... The problem is that XML has become such a defacto standard that it used automatically, without thought, even when there are much better alternatives available. I agree with you but, as you say, it has become a defacto standard. As a result, we often

Re: Trying to parse a HUGE(1gb) xml file

2010-12-27 Thread Alan Meyer
On 12/21/2010 3:16 AM, Stefan Behnel wrote: Adam Tauno Williams, 20.12.2010 20:49: ... You need to process the document as a stream of elements; aka SAX. IMHO, this is the worst advice you can give. Why do you say that? I would have thought that using SAX in this application is an excelle

Re: Parsing markup.

2010-11-29 Thread Alan Meyer
On 11/29/2010 11:20 AM, Joe Goldthwaite wrote: Hi MRAB, I was trying to avoid regex because my poor old brain has trouble with it. I have to admin though, that line is slick! I'll have to go through my regex documentation to try and figure out what it actually means. Personally, I'd be hesita

Re: sqlite autoincrement of primary key

2010-11-29 Thread Alan Meyer
On 11/29/2010 1:12 PM, tinauser wrote: Dear List I'm writing an application that has to create and populate an SQLite database. I'm doing pretty well, but now I'm facing a problem I can not solve. I create a table with a primary key autoincrement, something like sqlcmd="CREATE TABLE foo (id INT

Re: Saving (unusual) linux filenames

2010-08-31 Thread Alan Meyer
On 8/31/2010 2:33 PM, Nobody wrote: ... FWIW, my usual solution is URL-encoding (i.e. replacing any "awkward" character by a "%" followed by two hex digits representing the byte's value). It has the advantage that you can extend the set of bytes which need encoding as needed without having to ch

gen_py target directory for makepy

2008-04-08 Thread Alan Meyer
I had an unusual problem tonight running makepy to install some Microsoft COM interfaces in a Python 2.5 Windows XP installation created using the ActiveState installer. In earlier versions of Python, the files were generated to: \PythonXX\Lib\site-packages\win32com\gen_py But in my 2.5 insta

Re: Hiding tracebacks from end-users

2007-10-23 Thread Alan Meyer
On Oct 23, 12:07 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: ... > if expert_mode: > # experts get the full traceback with no hand-holding. > raise > else: > # print a more friendly error message ... Another approach is to always print a frien

Re: Please assist- Python Consultant needed for 3-6 month project

2007-08-30 Thread Alan Meyer
On Aug 30, 12:06 pm, "Kelley McNeillie" <[EMAIL PROTECTED]> wrote: > ... We are looking for a python developer with web-based > application experience. ... I am finding this skill pretty much > impossible to identify locally ... Kelley, I don't know if your client is willing to pay for a week o

Re: Python Search Engine app

2005-09-14 Thread Alan Meyer
"Alan Meyer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] ... > I stand ready to be corrected, but I think Python would not be a > good language for writing search engines. In the ones I've written > for custom projects - in C or PL/1, it has been ne

Re: Python Search Engine app

2005-09-14 Thread Alan Meyer
"Harlin Seritt" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > Is anyone aware of an available open-source/free search engine app > (something similar to HTDig) written in Python that is out there? > Googling has turned up nothing. Thought maybe I'd mine some of you > guys'