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: How well do you know Python?

2016-07-05 Thread Carl Meyer
On 07/05/2016 05:50 AM, Chris Angelico wrote: > On Tue, Jul 5, 2016 at 9:33 PM, Peter Otten <__pete...@web.de> wrote: >> Chris Angelico wrote: >> >>> On Tue, Jul 5, 2016 at 6:36 PM, Peter Otten <__pete...@web.de> wrote: What will $ cat foo.py import foo class A: pass p

Re: pytz and Python timezones

2016-06-12 Thread Carl Meyer
Hi Johannes, On 06/11/2016 05:37 AM, Johannes Bauer wrote: > I try to create a localized timestamp > in the easiest possible way. So, intuitively, I did this: > > datetime.datetime(2016,1,1,0,0,0,tzinfo=pytz.timezone("Europe/Berlin")) That is indeed intuitive, but unfortunately (due to a misunde

Re: recursive methods require implementing a stack?

2016-04-06 Thread Carl Meyer
On 04/06/2016 03:08 PM, Random832 wrote: > On Wed, Apr 6, 2016, at 16:21, Charles T. Smith wrote: >> I just tried to write a recursive method in python - am I right that >> local >> variables are only lexically local scoped, so sub-instances have the same >> ones? Is there a way out of that? Do I

Re: Missing something about timezones

2016-03-14 Thread Carl Meyer
Hi Skip, On 03/14/2016 09:32 AM, Skip Montanaro wrote: > On Mon, Mar 14, 2016 at 10:26 AM, Ian Kelly wrote: >> Why should it? You only asked pytz for the Chicago timezone. You >> didn't ask for it relative to any specific time. > > Thanks. I thought using America/Chicago was supposed to automagi

Re: Continuing indentation

2016-03-02 Thread Carl Meyer
On 03/02/2016 04:54 PM, Chris Angelico wrote: > On Thu, Mar 3, 2016 at 10:46 AM, wrote: >> On Wednesday, March 2, 2016 at 3:44:07 PM UTC-5, Skip Montanaro wrote: >>> >>> if (some_condition and >>> some_other_condition and >>> some_final_condition): >>> play_bingo() >>

Re: Importing two modules of same name

2016-02-09 Thread Carl Meyer
Hi Tim, On 02/09/2016 04:23 PM, Tim Johnson wrote: > Before proceding, let me state that this is to satisfy my > curiousity, not to solve any problem I am having. > > Scenario : > Web application developed at /some/dir/sites/flask/ > > If I have a package - let us call it app and in my > /some/d

Re: does the order in which the modules are placed in a file matters ?

2015-12-16 Thread Carl Meyer
Hi Ganesh, On 12/16/2015 09:09 AM, Ganesh Pal wrote: > Iam on python 2.7 and linux .I need to know if we need to place the > modules in a particular or it doesn't matter at all > > order while writing the program As you've probably already noticed, it usually doesn't matter to Python (though it

Re: Python 3 virtualenvs

2015-11-30 Thread Carl Meyer
On 11/30/2015 10:20 AM, Laura Creighton wrote: > In a message of Mon, 30 Nov 2015 09:32:27 -0700, Carl Meyer writes: >>> I think it is only meant to be used by people who want to install >>> packages but not site-wide, but I am not sure about that. >> >> I don&#x

Re: Python 3 virtualenvs

2015-11-30 Thread Carl Meyer
Hi Laura, On 11/29/2015 07:12 AM, Laura Creighton wrote: > pyenv is going away. python -m venv is the preferred way to get a venv > > https://bugs.python.org/issue25154 > > Of course if you try it, you may get: > > Error: Command '['/bin/python3.4', '-Im', 'ensurepip', > '--upgrade', '--def

Re: List comprehension with if-else

2015-10-28 Thread Carl Meyer
Hi Larry, On 10/28/2015 10:25 AM, Larry Martell wrote: > I'm trying to do a list comprehension with an if and that requires an > else, but in the else case I do not want anything added to the list. > > For example, if I do this: > > white_list = [l.control_hub.serial_number if l.wblist == > wbli

Re: Understanding WSGI together with Apache

2015-10-12 Thread Carl Meyer
Hi Johannes, On 10/10/2015 08:24 AM, Johannes Bauer wrote: > I'm running an Apache 2.4 webserver using mod_wsgi 4.3.0. There are two > different applications running in there running on two completely > separate vhosts. > > I'm seeing some weird crosstalk between them which I do not understand. >

Re: True == 1 weirdness

2015-09-16 Thread Carl Meyer
On 09/16/2015 02:29 PM, Mark Lawrence wrote: > On 16/09/2015 18:53, Sven R. Kunze wrote: >> On 16.09.2015 19:39, Steven D'Aprano wrote: >>> node = left <= ptr => right >> >> Wow. I have absolutely no idea what this is supposed to mean. Do you >> care to elaborate? >> >> >> Best, >> Sven > > Simple

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

2015-09-14 Thread Carl Meyer
Can we please stop cross-posting this thread to python-list and move it to datetime-sig only? I think anyone here on python-list who is sufficiently interested in it can subscribe to datetime-sig. Or the other way around, whatever. I'd just like to stop getting all the messages twice. Carl sig

Re: Are there any "correct" implementations of tzinfo?

2015-09-12 Thread Carl Meyer
On 09/12/2015 12:23 PM, Random832 wrote: > I was trying to find out how arithmetic on aware datetimes is "supposed > to" work, and tested with pytz. When I posted asking why it behaves this > way I was told that pytz doesn't behave correctly according to the way > the API was designed. The tzlocal

Re: Searching for a usable X509 implementation

2015-07-03 Thread Carl Meyer
Hi Dennis, On 07/03/2015 06:11 PM, Dennis Jacobfeuerborn wrote: > Hi, I'm trying to implement certificate functionality in a python app > but after fighting with pyOpenSSL and M2Crypto I'm thinking about > writing wrapper functions for the OpenSSL command line tool instead > or switching the app t

Re: Using a particular python binary with venv

2015-06-01 Thread Carl Meyer
On 06/01/2015 04:07 PM, greenbay.gra...@gmail.com wrote: > On Tuesday, 2 June 2015 09:43:37 UTC+12, Carl Meyer wrote: >> On 06/01/2015 03:33 PM, orotau wrote: >>> According to this >>> https://docs.python.org/3.4/library/venv.html#module-venv 'Each >>&g

Re: Using a particular python binary with venv

2015-06-01 Thread Carl Meyer
On 06/01/2015 03:33 PM, greenbay.gra...@gmail.com wrote: > According to this > https://docs.python.org/3.4/library/venv.html#module-venv 'Each > virtual environment has its own Python binary (allowing creation of > environments with various Python versions)' > > So how would I create a virtual e

Re: mixing set and list operations

2015-04-30 Thread Carl Meyer
Hi Tim, On 04/30/2015 10:07 AM, Tim wrote: > I noticed this today, using Python2.7 or 3.4, and wondered if it is > implementation dependent: > > You can use 'extend' to add set elements to a list and use 'update' to add > list elements to a set. > m = ['one', 'two'] p = set(['three',

Re: Python 3 lack of support for fcgi/wsgi.

2015-03-29 Thread Carl Meyer
On 03/29/2015 09:30 PM, Michael Torrie wrote: > What does this have to do with Python itself? I'm not completely sure, > but maybe it's about the Python community. What's the way forward? I > have no idea. At the very least John is frustrated by the community's > lack of apparent interest in fi

Re: Daylight savings time question

2015-03-25 Thread Carl Meyer
Hi Dan, On 03/24/2015 04:24 PM, Dan Stromberg wrote: > Is there a way of "adding" 4 hours and getting a jump of 5 hours on > March 8th, 2015 (due to Daylight Savings Time), without hardcoding > when to spring forward and when to fall back? I'd love it if there's > some library that'll do this for

Re: Daylight savings time question

2015-03-25 Thread Carl Meyer
On 03/24/2015 04:56 PM, Chris Angelico wrote: > On Wed, Mar 25, 2015 at 9:24 AM, Dan Stromberg wrote: >> Is there a way of "adding" 4 hours and getting a jump of 5 hours on >> March 8th, 2015 (due to Daylight Savings Time), without hardcoding >> when to spring forward and when to fall back? I'd l

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

Directly Executable Files in Python

2011-03-28 Thread Jordan Meyer
Is it possible to make a directly executable (such as .exe on Windows) file from scripts written in Python? So as to prevent the end-user from having to download an interpreter to run the program. -- http://mail.python.org/mailman/listinfo/python-list

Re: Instant File I/O

2011-03-24 Thread Jordan Meyer
That did the trick! Thanks! -- http://mail.python.org/mailman/listinfo/python-list

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: formatted input

2010-09-07 Thread Kenny Meyer
ords1") match_2 = re.compile("^words2") # Return a match object each re.match(match_1, "word11") re.match(match_2, "word21") I'm sure there are might be other ways to do the same thing. -- - Kenny Meyer To understand recursion, we must first understand recursion. -- -- http://mail.python.org/mailman/listinfo/python-list

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

Re: cscope like source code navigation for python code

2010-08-08 Thread Kenny Meyer
if you have seen the new version: http://pypi.python.org/pypi/pycscope/0.3 -- Onward and upwards, .O. Kenny Meyer ..O :wq OOO signature.asc Description: Digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Check if a command is valid

2010-07-14 Thread Kenny Meyer
On Jul 13, 4:14 pm, Hans Mulder wrote: > Chris Rebert wrote: > > `where` seems to be a zsh built-in: > > $ # I'm in UR bash > > $ nonexistent > > -bash: nonexistent: command not found > > $ where bash > > -bash: where: command not found > > > And not everyone has zsh installed, so... > > I don't s

Re: Check if a command is valid

2010-07-13 Thread Kenny Meyer
Chris Rebert (c...@rebertia.com) wrote: > On Mon, Jul 12, 2010 at 6:29 PM, Kenny Meyer wrote: > > Hello, > > > > I have to figure out if a string is callable on a Linux system. I'm > > "callable" seems vague. Is a command string with invalid arguments

Check if a command is valid

2010-07-12 Thread Kenny Meyer
Hello, I have to figure out if a string is callable on a Linux system. I'm actually doing this: def is_valid_command(command): retcode = 100 # initialize if command: retcode = subprocess.call(command, shell=True) if retcode is 0: print "Valid co

Re: plac, the easiest command line arguments parser in the world

2010-06-04 Thread Kenny Meyer
On Jun 2, 12:37 am, Michele Simionato wrote: > I would like to announce to the world the first public release of > plac: > >  http://pypi.python.org/pypi/plac > > Plac is a wrapper over argparse and works in all versions of > Python starting from Python 2.3 up to Python 3.1. > > With blatant immod

Re: multiprocessing and dictionaries

2009-07-13 Thread Bjorn Meyer
On Monday 13 July 2009 13:12:18 Piet van Oostrum wrote: > >>>>> Bjorn Meyer (BM) wrote: > > > >BM> Here is what I have been using as a test. > >BM> This pretty much mimics what I am trying to do. > >BM> I put both threading and multiprocessing

Re: multiprocessing and dictionaries

2009-07-13 Thread Bjorn Meyer
On Monday 13 July 2009 01:56:08 Piet van Oostrum wrote: > >>>>> Bjorn Meyer (BM) wrote: > > > >BM> I am trying to convert a piece of code that I am using the thread > > module with BM> to the multiprocessing module. > > > >BM> The way t

multiprocessing and dictionaries

2009-07-12 Thread Bjorn Meyer
I am trying to convert a piece of code that I am using the thread module with to the multiprocessing module. The way that I have it set up is a chunk of code reads a text file and assigns a dictionary key multiple values from the text file. I am using locks to write the values to the dictionary

Re: One class per file?

2008-10-04 Thread Tony Meyer
[HCB] The book "Code Complete" recommends that you put only one class in a source file, which seems a bit extreme for me. IMO this is a misunderstanding (by the author). In Python, a file is not equivalent to a class, it is equivalent to a module. A module might contain a single class or

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: script won't run using cron.d or crontab

2008-03-21 Thread Bjorn Meyer
Thank you for your reply. This is pretty much what I found from my digging around. I asume this can still be done. Is there an easy way to determine what needs to be added to the environment? Bjorn On Fri, Mar 21, 2008 at 2:01 AM, Robert Bossy <[EMAIL PROTECTED]> wrote: > Bjorn Me

script won't run using cron.d or crontab

2008-03-20 Thread Bjorn Meyer
I appologize if this been discussed previously. If so, just point me to that information. I have done a fair bit of digging, but I haven't found a description of what to actually do. I have a fairly lengthy script that I am able to run without any problems from a shell. My problem is, now I am wa

Re: super, decorators and gettattribute

2008-01-12 Thread Mike Meyer
On Sat, 12 Jan 2008 10:45:25 -0800 (PST) Richard Szopa <[EMAIL PROTECTED]> wrote: > Hello all, > > I am playing around w/ Python's object system and decorators and I > decided to write (as an exercise) a decorator that (if applied to a > method) would call the superclass' method of the same name

Re: where do my python files go in linux?

2008-01-12 Thread Mike Meyer
On Sat, 12 Jan 2008 16:13:08 +0100 "Jorgen Bodde" <[EMAIL PROTECTED]> wrote: > > Normally you'd split up the bulk of the code into a module which gets > > installed into site-packages and a piece of stand-alone front-end code which > > imports the module and executes whatever you need to do and get

Re: Import and execfile()

2008-01-12 Thread Mike Meyer
On Fri, 11 Jan 2008 20:55:07 -0800 (PST) George Sakkis <[EMAIL PROTECTED]> wrote: > On Jan 11, 5:24 pm, Mike Meyer <[EMAIL PROTECTED]> > wrote: > > On Fri, 11 Jan 2008 14:05:11 -0800 (PST) George Sakkis <[EMAIL PROTECTED]> > > wrote: > > > I mainta

Re: Newbie Q: modifying SQL statements

2008-01-11 Thread Mike Meyer
On Fri, 11 Jan 2008 18:11:41 -0500 "Faber J. Fedor" <[EMAIL PROTECTED]> wrote: > On 10/01/08 22:53 -0500, Mike Meyer wrote: > > Personally, I think it would be more pythonic to not try and use two > > different APIs to walk the list of jobs (... One Way To Do

Re: encrypting python modules

2008-01-11 Thread Mike Meyer
On Sat, 12 Jan 2008 09:47:26 +1100 Ben Finney <[EMAIL PROTECTED]> wrote: > Paul Sijben <[EMAIL PROTECTED]> writes: > > I know that I can not stop a dedicated hacker deconstructing my code. > A direct consequence of this is that you can not stop *anyone* from > deconstructing your code if it's in t

Re: for loop without variable

2008-01-11 Thread Mike Meyer
On Fri, 11 Jan 2008 22:18:22 GMT Neil Hodgson <[EMAIL PROTECTED]> wrote: > Marty: > > I recently faced a similar issue doing something like this: > > data_out = [] > > for i in range(len(data_in)): > > data_out.append([]) > > Another way to write this is > data_out = [[]] * le

Re: Import and execfile()

2008-01-11 Thread Mike Meyer
On Fri, 11 Jan 2008 14:05:11 -0800 (PST) George Sakkis <[EMAIL PROTECTED]> wrote: > I maintain a few configuration files in Python syntax (mainly nested > dicts of ints and strings) and use execfile() to read them back to > Python. This has been working great; it combines the convenience of > pic

Re: Python Frontend/GUI for C Program

2008-01-11 Thread Mike Meyer
On Fri, 11 Jan 2008 08:12:48 -0800 (PST) [EMAIL PROTECTED] wrote: > I have a C program that works very well. However, being C it has no > GUI. What does C have to do with it not having a GUI? I've written more C programs with a GUI than Python ones - and the C experience was generally better. Of c

Re: improving performance of python webserver running python scripts in cgi-bin

2008-01-11 Thread Mike Meyer
On Thu, 10 Jan 2008 23:17:28 -0800 (PST) Dale <[EMAIL PROTECTED]> wrote: > I am using a simple python webserver (see code below) to serve up > python scripts located in my cgi-bin directory. > > import BaseHTTPServer > import CGIHTTPServer > class Handler(CGIHTTPServer.CGIHTTPRequestHandler): >

Re: How to POST call and retrieve result page

2008-01-11 Thread Mike Meyer
On Fri, 11 Jan 2008 14:44:19 +0530 "suyash jape" <[EMAIL PROTECTED]> wrote: > Hi all > i want to access a web page through python script, fillup the necessary > fields, > and press submit button (which does POST call) and retrieve the result page > and retrieve some values from it. > > Here is th

Re: Magic function

2008-01-11 Thread Mike Meyer
On Fri, 11 Jan 2008 08:29:18 -0800 (PST) [EMAIL PROTECTED] wrote: > Hi all, > > I'm part of a small team writing a Python package for a scientific > computing project. The idea is to make it easy to use for relatively > inexperienced programmers. As part of that aim, we're using what we're > call

Re: Learning Python via a little word frequency program

2008-01-11 Thread Mike Meyer
On 11 Jan 2008 03:50:53 -0800 Paul Rubin <"http://phr.cx"@NOSPAM.invalid> wrote: > rent <[EMAIL PROTECTED]> writes: > > keys = freq.keys() > > keys.sort(key = freq.get, reverse = True) > > for k in keys: > > print "%-10s: %d" % (k, freq[k]) > > I prefer (untested): > > def snd((x,y)): ret

Re: for loop without variable

2008-01-10 Thread Mike Meyer
On Fri, 11 Jan 2008 01:48:43 -0500 Marty <[EMAIL PROTECTED]> wrote: > Mike Meyer wrote: > >> This caused me to wonder why Python does not have a "foreach" statement > >> (and > >> also why has it not come up in this thread)? I realize the topic ha

Re: for loop without variable

2008-01-10 Thread Mike Meyer
On Thu, 10 Jan 2008 22:36:56 -0500 Marty <[EMAIL PROTECTED]> wrote: > I recently faced a similar issue doing something like this: > > data_out = [] > for i in range(len(data_in)): > data_out.append([]) More succinctly: data_out = [] for _ in data_in: data_out.append([]) Or, a

Re: Newbie Q: modifying SQL statements

2008-01-10 Thread Mike Meyer
On Thu, 10 Jan 2008 20:32:06 -0500 "Faber J. Fedor" <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm in the process of learning Python by writing a job queue program. > Nothing fancy, mind you, just read from a table, shell out to a program, > write back to the table. > > I'm working off of the tuto

  1   2   3   4   5   6   7   8   9   10   >