Re: Conditional decoration

2012-06-18 Thread Emile van Sebille
On 6/18/2012 3:16 PM Roy Smith said... Is there any way to conditionally apply a decorator to a function? For example, in django, I want to be able to control, via a run-time config flag, if a view gets decorated with @login_required(). @login_required() def my_view(request): pass class

Re: emded revision control in Python application?

2012-06-22 Thread Emile van Sebille
On 6/22/2012 8:58 AM duncan smith said... Hello, I have an application that would benefit from collaborative working. Over time users construct a "data environment" which is a number of files in JSON format contained in a few directories You don't say what your target platform is, but on linux

Re: emded revision control in Python application?

2012-06-22 Thread Emile van Sebille
On 6/22/2012 11:19 AM duncan smith said... On 22/06/12 17:42, Emile van Sebille wrote: On 6/22/2012 8:58 AM duncan smith said... Hello, I have an application that would benefit from collaborative working. Over time users construct a "data environment" which is a number of files in J

Re: Which way is best to execute a Python script in Excel?

2012-07-05 Thread Emile van Sebille
On 7/5/2012 12:22 AM Maurizio Spadaccino said... Hi all I'm new to Python but soon after a few days of studying its features I find it my favourite mean of programming scripts to allow for data storing and mining. My idea would be to inplement python scripts from inside an excel sheet that would

Re: Which way is best to execute a Python script in Excel?

2012-07-06 Thread Emile van Sebille
On 7/6/2012 1:31 AM Maurizio Spadaccino said... Could you provide me a more detailed 'how-to' tutorial on implementing a VBA macro that calls a script or a function from python, or tell me where on the web I can find it? The OReilly chapter seems a bit hard for me at this stage? I'm not goin

Re: Which way is best to execute a Python script in Excel?

2012-07-07 Thread Emile van Sebille
On 7/7/2012 2:05 AM Maurizio Spadaccino said... Thanks again Emile, I'll try out some examples. I found this one: http://showmedo.com/videotutorials/video?name=2190050&fromSeriesID=219 quite enlightning. One last doubt is: say the python code gets used by more Excel Users (different pc), can I

Re: select module missing/corrupt

2012-07-07 Thread Emile van Sebille
On 7/7/2012 5:03 AM John Pote said... We are using a virtual web server running some version of Unix. It has Python versions 2.4,2.6 and 3.1 pre-installed. (BTW the intention is to use Python for a CGI script.) When my script imports subprocess I get the traceback File "/usr/lib/python2.6/subpr

Re: Python Interview Questions

2012-07-09 Thread Emile van Sebille
On 7/9/2012 2:22 PM Peter said... One of my favourite questions when interviewing - and it was 100% reliable :-) - "what are your hobbies?" If the answer included programming then they were hired, if not, then they went to the "B" list. In my experience, anybody who is really interested in pr

Re: What's wrong with this code?

2012-07-23 Thread Emile van Sebille
On 7/23/2012 7:50 AM Stone Li said... I'm totally confused by this code: Code: a = None b = None c = None d = None x = [[a,b], [c,d]] e,f = x[1] print e,f This prints the first None,None c = 1 d = 2 print e,f And nothing has happened to e

Re: Python and Outlook, sendinf an image in the body of email

2012-07-23 Thread Emile van Sebille
On 7/23/2012 11:33 AM [email protected] said... I tried something similar to the example at http://stackoverflow.com/questions/4312687/how-to-embed-images-in-email . Problem is, this line is not understood: mail.BodyFormat = OlBodyFormat.olFormatHTML If I read the example properl

Re: Generating valid identifiers

2012-07-26 Thread Emile van Sebille
On 7/26/2012 5:26 AM Laszlo Nagy said... I have a program that creates various database objects in PostgreSQL. There is a DOM, and for each element in the DOM, a database object is created (schema, table, field, index and tablespace). I do not want this program to generate very long identifiers.

Re: Python Error

2012-07-29 Thread Emile van Sebille
On 7/29/2012 5:30 AM [email protected] said... On Sunday, July 29, 2012 2:57:18 PM UTC+5:30, (unknown) wrote: Dear Group, I was trying to convert the list to a set, with the following code: set1=set(list1) Thanks for the answer. But my list does not contain another list that is the issu

Re: Is Python a commercial proposition ?

2012-07-30 Thread Emile van Sebille
On 7/29/2012 5:12 PM Rodrick Brown said... Until the GIL is fixed I doubt anyone will seriously look at Python as an option for large enterprise standalone application development. See openERP -- http://www.openerp.com/ -- they've been actively converting SAP accounts and have recently absorbe

Re: Linux shell to python

2012-07-30 Thread Emile van Sebille
On 7/30/2012 3:56 PM Dan Stromberg said... On Mon, Jul 30, 2012 at 9:26 PM, Barry Scott And of course you can write list comprehensions on as many lines as it take to make the code maintainable. Sigh, and I'm also not keen on multi-line list comprehensions, specifically because I thi

Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread Emile van Sebille
On 8/6/2012 10:14 AM Tom P said... On 08/06/2012 06:18 PM, Nobody wrote: On Mon, 06 Aug 2012 17:52:31 +0200, Tom P wrote: consider a nested loop algorithm - for i in range(100): for j in range(100): do_something(i,j) Now, suppose I don't want to use i = 0 and j = 0 as initial

Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread Emile van Sebille
On 8/6/2012 12:22 PM Grant Edwards said... On 2012-08-06, Tom P wrote: ah, that looks good - I guess it works in 2.x as well? I don't know. Let me test that for you... Yes, it works in 2.x as well. :) And from the docs, all the way back to 2.3! 9.7. itertools Functions creati

Re: [newbie] String to binary conversion

2012-08-06 Thread Emile van Sebille
On 8/6/2012 1:46 PM Mok-Kong Shen said... If I have a string "abcd" then, with 8-bit encoding of each character, there is a corresponding 32-bit binary integer. How could I best obtain that integer and from that integer backwards again obtain the original string? Thanks in advance. It's easy t

Re: Running Python web apps on shared ASO servers?

2012-08-16 Thread Emile van Sebille
On 8/16/2012 7:01 AM Gilles said... On Sun, 12 Aug 2012 02:03:33 +0200, Gilles wrote: Does it mean that ASO only supports writing Python web apps as long-running processes (CGI, FCGI, WSGI, SCGI) instead of embedded Python à la PHP? I need to get the big picture about the different solutions

Re: Python 2.7 import socket urllib fails to load, module not found

2012-08-17 Thread Emile van Sebille
On 8/17/2012 12:20 PM [email protected] said... Just installed python 2.7 and using with web2py. When running python from command line to bring up web2py server, get errors that python socket and urllib modules cannot be found, can't be loaded. This is not a web2py issue. So, on my system

Re: Python 2.7 import socket urllib fails to load, module not found

2012-08-17 Thread Emile van Sebille
On 8/17/2012 1:41 PM [email protected] said... From cmd prompt - I get this: Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. import urllib Traceback (most recent call last): File "",

Re: Python 2.7 import socket urllib fails to load, module not found

2012-08-17 Thread Emile van Sebille
On 8/17/2012 2:22 PM [email protected] said... Done - tail end of the python path had a missing bit...gr... thanks so much Well it's bizarre - now it doesn't. did an import sys from within interpreter, then did import socket. Worked the first time. Restarted and it happened again. Th

Re: python 6 compilation failure on RHEL

2012-08-20 Thread Emile van Sebille
On 8/20/2012 6:31 AM Ganesh Reddy K said... But, python compilation is not successfully done and showing a failure log. Below is the capture of the same. Please see failure log shown in the bottom of this mail. How to solve the failure modules mentioned in the log ( bsddb185, dl , imageop, su

Re: python 6 compilation failure on RHEL

2012-08-20 Thread Emile van Sebille
On 8/20/2012 10:20 AM Walter Hurry said... On Mon, 20 Aug 2012 19:12:05 +0200, Kwpolska wrote: >Do you really need to compile python2.6? RHEL has packages for python, >and it's better s/better/sometimes easier > to use pre-compiled packages rather than compile them yourself. I concu

Re: python 6 compilation failure on RHEL

2012-08-20 Thread Emile van Sebille
On 8/20/2012 11:37 AM Walter Hurry said... On Mon, 20 Aug 2012 11:02:25 -0700, Emile van Sebille wrote: On 8/20/2012 10:20 AM Walter Hurry said... I concur, but FYI the version of Python with RHEL5 is 2.4. Still, OP should stick with that unless there is a pressing reason. Hence, the 2.6

Re: python 6 compilation failure on RHEL

2012-08-20 Thread Emile van Sebille
On 8/20/2012 1:55 PM Walter Hurry said... On Mon, 20 Aug 2012 12:19:23 -0700, Emile van Sebille wrote: Package dependencies. If the OP intends to install a package that doesn't support other than 2.6, you install 2.6. It would be a pretty poor third party package which specified Pytho

Re: python 6 compilation failure on RHEL

2012-08-20 Thread Emile van Sebille
On 8/20/2012 9:34 PM John Nagle said... After a thread of clueless replies, s/clueless/unread Emile -- http://mail.python.org/mailman/listinfo/python-list

Re: Filter versus comprehension (was Re: something about split()???)

2012-08-24 Thread Emile van Sebille
On 8/24/2012 3:03 PM Terry Reedy said... On 8/24/2012 5:56 PM, Dennis Lee Bieber wrote: On Fri, 24 Aug 2012 19:03:51 + (UTC), Walter Hurry declaimed the following in gmane.comp.python.general: Google Groups sucks. These are computer literate people here. Why don't they just use a proper

Re: Time Bound Input in python

2012-09-03 Thread Emile van Sebille
On 9/3/2012 3:01 AM Vikas Kumar Choudhary said... Hi I though of taking time bound input from user in python using "input" command. it waits fro infinite time , but I want to limit the time after that user input should expire with none. Please help. Googling yields http://stackoverflow.com/q

Re: Error 32 - Broken Pipe . Please Help!!

2012-09-04 Thread Emile van Sebille
On 9/4/2012 10:08 AM Sreenath k said... Error: Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner self.run() File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/monitor.py", line

Re: How to print something only if it exists?

2012-09-06 Thread Emile van Sebille
On 9/6/2012 10:59 AM [email protected] said... I want to print a series of list elements some of which may not exist, e.g. I have a line:- print day, fld[1], balance, fld[2] fld[2] doesn't always exist (fld is the result of a split) so the print fails when it isn't set. I know I could s

Re: SAP MM Cupertino, CA

2012-09-10 Thread Emile van Sebille
On 9/10/2012 7:58 AM Ramchandra Apte said... On Monday, 10 September 2012 18:51:10 UTC+5:30, Suresh Kumar wrote: delete the original message. Marking this as abusive in Google Groups - this seems like spam. Please explain what does this have to do with Python. Please learn to trim -- your

Re: Guides for communicating with business accounting systems

2012-09-13 Thread Emile van Sebille
On 9/13/2012 8:02 AM Ben Finney said... Howdy all, What material should a team of programmers read before designing a database model and export format for sending commerce transactions to a business accounting system? The only standard I'm aware of is the EDI specification which I first encou

Re: Passing arguments to & executing, a python script on a remote machine from a python script on local machine (using ssh ?)

2012-09-20 Thread Emile van Sebille
On 9/19/2012 12:50 PM ashish said... Hi c.l.p folks Here is my situation 1. I have two machines. Lets call them 'local' & 'remote'. Both run ubuntu & both have python installed 2. I have a python script, local.py, running on 'local' which needs to pass arguments ( 3/4 string arguments, contai

Re: technologies synergistic with Python

2012-09-22 Thread Emile van Sebille
On 9/21/2012 2:59 PM Ethan Furman said... ...if my dream job is one that consists mostly of Python, and might allow telecommuting? Hi Ethan, I have an open position in my two man office I've tried to fill a couple times without success that is predominately python and would allow for telecom

Re: One of my joomla webpages has been hacked. Please help.

2012-09-26 Thread Emile van Sebille
On 9/26/2012 6:06 PM Wayne Werner said... On Sun, 23 Sep 2012, Dwight Hutto wrote: We're the borg. Oh, so you *are* a robot. That does explain your posts ;) Damn. Now I'll forever more hear Stephen Hawkin's voice as I read the repeated contexts. Maybe that'll help. EMile -- http://m

Re: test

2012-09-27 Thread Emile van Sebille
On 9/27/2012 2:58 PM Rikishi42 said... Inboxes? What is this, usenet or email ? Yes. Both. Emile -- http://mail.python.org/mailman/listinfo/python-list

Re: how to insert random error in a programming

2012-10-15 Thread Emile van Sebille
Debashish Saha wrote: how to insert random error in a programming? Make the changes late in the day then leave for the weekend? Emile -- http://mail.python.org/mailman/listinfo/python-list

Re: numpy - 2D matrix/array - initialization like in Matlab...

2012-10-15 Thread Emile van Sebille
someone wrote: How to initialize my array directly using variables ? It could also be that I wanted: test11 = 1 test12 = 1.5 test13 = 2 test21 = 0 test22 = 5 Dx = numpy.matrix('test11 test12 test13; test21 test22 -0.5; 0 -0.5 1.5') Etc... for many variables... Appreciate ANY help, thank you

Re: Python does not take up available physical memory

2012-10-19 Thread Emile van Sebille
On 10/19/2012 10:08 AM, Pradipto Banerjee wrote: Hi, I am trying to read a file into memory. The size of the file is around 1 GB. I have a 3GB memory PC and the Windows Task Manager shows 2.3 GB available physical memory when I was trying to read the file. I tried to read the file as follows:

Re: get each pair from a string.

2012-10-21 Thread Emile van Sebille
On 10/21/2012 11:33 AM, Vincent Davis wrote: I am looking for a good way to get every pair from a string. For example, input: x = 'apple' output 'ap' 'pp' 'pl' 'le' I am not seeing a obvious way to do this without multiple for loops, but maybe there is not :-) In the end I am going to what to ge

Re: get each pair from a string.

2012-10-21 Thread Emile van Sebille
On 10/21/2012 11:51 AM, Ian Kelly wrote: On Sun, Oct 21, 2012 at 12:33 PM, Vincent Davis wrote: I am looking for a good way to get every pair from a string. For example, input: x = 'apple' output 'ap' 'pp' 'pl' 'le' I am not seeing a obvious way to do this without multiple for loops, but maybe

Re: get each pair from a string.

2012-10-21 Thread Emile van Sebille
On 10/21/2012 12:06 PM, Ian Kelly wrote: On Sun, Oct 21, 2012 at 12:58 PM, Vincent Davis wrote: x = 'apple' for f in range(len(x)-1): print(x[f:f+2]) @Ian, Thanks for that I was just looking in to that. I wonder which is faster I have a large set of strings to process. I'll try some timin

Re: get each pair from a string.

2012-10-22 Thread Emile van Sebille
On 10/21/2012 9:19 PM, Ian Foote wrote: On 22/10/12 09:03, Emile van Sebille wrote: So, as OP's a self confessed newbie asking about slicing, why provide an example requiring knowledge of tee, enumerate, next and izip? Because not only the newbie will read the thread? I for on

Re: Fast forward-backward (write-read)

2012-10-24 Thread Emile van Sebille
On 10/23/2012 4:35 PM, emile wrote: So, let's see, at that point in time (building backward) you've got probably somewhere close to 400-500Gb in memory. My guess -- probably not so fast. Thrashing is sure to be a factor on all but machines I'll never have a chance to work on. I went looking

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-15 Thread Emile van Sebille
[email protected] wrote: Using a decorator works when named arguments are not used. When named arguments are used, unexpected keyword error is reported. Is there a simple fix? Extend def wrapper(*args) to handle *kwargs as well Emile Code: - from functools import wraps def fix

Re: Compare list entry from csv files

2012-11-26 Thread Emile van Sebille
Anatoli Hristov wrote: I understand, but in my case I have for sure the field "Name" in the second file that contains at least the first or the last name on it... So probably it should be possible:) The Name "Billgatesmicrosoft" contains the word "Gates" so logically I might find a solution for i

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-27 Thread Emile van Sebille
On 1/25/2012 9:14 PM Steven D'Aprano said... In the same way that a native English speaker would never make the mistake of using "organ" to refer to an unnamed mechanical device, so she would never use "gadget" to refer to an unnamed body part. My wife introduced me to the term "picnic gadget"

Re: runtime error

2012-01-28 Thread Emile van Sebille
On 1/27/2012 10:38 AM nikos spanakis said... Hi I just minstalled python 3.1 on my windons XP SP3 but on the start up I get the following error message: You don't say what you specifically installed, but for windows you may find activestates distribution a good fit. See http://www.activest

Re: list of properties

2012-02-16 Thread Emile van Sebille
On 2/16/2012 9:19 AM Emmanuel Mayssat said... Hello, Is there a way to list 'properties' ? dir(thingy) from PyQt4.QtCore import * class LObject(QObject): def __init__(self, parent=None): super(LObject, self).__init__(parent) self.arg1 = 'toto' def getArg2(self

Re: ReportLab alternative for Python3

2012-03-21 Thread Emile van Sebille
On 3/21/2012 8:15 AM Katya said... Out of this GUI on user's request I want to create a report, > prefferebly in DOC or/and ODT or/and PDF or/and HTML formats. ReportLab which seems to be suitable is not ready for Python3. So, any reason why not to just run that part under python2 -- they t

Re: Python Script Works Locally But Not Remotely with SSH

2012-04-02 Thread Emile van Sebille
On 3/27/2012 5:51 PM goldtech said... Hi, I have a WinXP PC running an SSH server and I have a Linux PC with an SSH client and logged into the XP seemingly OK. It's all on my personal LAN, the connection seems OK. I have a py file on the XP that I run via SSH from the Linux, it's: import webb

Re: Python-URL! - weekly Python news and links (Mar 31)

2012-04-02 Thread Emile van Sebille
On 3/31/2012 8:38 AM Cameron Laird said... And it's time to bring "Python-URL!" to a close. Three cheers for your efforts over the years keeping this going. Many heartfelt thanks, Emile -- http://mail.python.org/mailman/listinfo/python-list

Re: Is Programing Art or Science?

2012-04-02 Thread Emile van Sebille
On 4/2/2012 4:52 PM Jürgen Exner said... "Pascal J. Bourguignon" wrote: ccc31807 writes: Programming is neither an art nor a science, but a trade. Oh, that's why it is tought in trade schools alongside butchery, plumbing, masonry, and chimney sweeping Yes -- back when we opened our firs

Re: Python Gotcha's?

2012-04-05 Thread Emile van Sebille
On 4/5/2012 11:10 AM Jon Clements said... On Wednesday, 4 April 2012 23:34:20 UTC+1, Miki Tebeka wrote: Greetings, I'm going to give a "Python Gotcha's" talk at work. If you have an interesting/common "Gotcha" (warts/dark corners ...) please share. (Note that I want over http://wiki.python.o

Re: Learning new APIs/classes (beginner question)

2012-04-06 Thread Emile van Sebille
On 4/6/2012 1:41 PM Martin Jones said... In a nutshell: My question is: how do experienced coders learn about external/third-party classes/APIs? I'm teaching myself Python through a combination of Hetland's 'Beginning Python', various online tutorials and some past experience coding ASP/VBScript

Re: Python randomly exits with Linux OS error -9 or -15

2012-04-09 Thread Emile van Sebille
On 4/9/2012 3:47 AM Alain Ketterlin said... Janis writes: I have this problem with my script exiting randomly with Linux OS status code -9 (most often) or -15 (also sometimes, but much more rarely). My guess is that your script hits a limit, e.g., number of open files, or stack-size, or...

Re: functions which take functions

2012-04-09 Thread Emile van Sebille
On 4/9/2012 11:57 AM Kiuhnm said... Do you have some real or realistic ... yes (but easy and self-contained) aah, no. examples when you had to define a (multi-statement) function and pass it to another function? This weekend I added functionality to a subsystem that allows users to

Re: Newbie python questions...

2012-04-14 Thread Emile van Sebille
On 4/14/2012 11:25 AM vmars316 said... win7HomePremium: Greetings, 1) I installed portablePython(pP) here: C:\Users\vmars\Python3 ?Does that look ok? 2) I would like to try pyWin, but it won't let me install because there is no pP3.2 in registry. ? How can I update the Registry for Python3.2

Re: I couldn't use the sign funcion inside of another function

2012-04-23 Thread Emile van Sebille
On 4/23/2012 11:39 AM Chris Rebert said... On Mon, Apr 23, 2012 at 11:29 AM, Julio Sergio wrote: I want to use the sign function. When I use it in in-line mode works pretty well: : sign(-20) : -1 However, I wrote the following code in a file, say, pp.py def tst(x): s = sign(x)

Re: int object

2012-04-28 Thread Emile van Sebille
On 4/27/2012 11:42 PM Debashish Saha said... 44 sph_yn_P=(l*sph_yn(l,K*R)/(K*R))-sph_yn(l,K*R) Here you're clearly multiplying by R... ---> 45 Beta_l=l-(K_P*R(sph_jv(l+1,K_P*R))/(sph_jv(l,K_P*R))) ... and here you've got R(...) which is attempting to call R() which isn't def

Re: Trouble splitting strings with consecutive delimiters

2012-05-01 Thread Emile van Sebille
re.split(':|;|px', "width:150px;height:50px;float:right") You could recognize that the delimiter you want to strip is in fact px; and not px in and of itself. So, try: re.split(':|px;', "width:150px;height:50px;float:right") Emile -- http://mail.python.org/mailman/listinfo/python-list

Re: Trouble splitting strings with consecutive delimiters

2012-05-01 Thread Emile van Sebille
On 5/1/2012 10:13 AM Temia Eszteri said... re.split(':|px;', "width:150px;height:50px;float:right") Emile That won't work at all outside of the example case. It'd choke on any attribute seperator that didn't end in px. It would certainly choke on all delimeters that are not presented in the

Re: key/value store optimized for disk storage

2012-05-04 Thread Emile van Sebille
On 5/4/2012 10:46 AM Tim Chase said... I hit a few snags testing this on my winxp w/python2.6.1 in that getsize wasn't finding the file as it was created in two parts with .dat and .dir extension. Also, setting key failed as update returns None. The changes I needed to make are marked below.

Re: key/value store optimized for disk storage

2012-05-04 Thread Emile van Sebille
On 5/4/2012 12:49 PM Tim Chase said... On 05/04/12 14:14, Emile van Sebille wrote: On 5/4/2012 10:46 AM Tim Chase said... I hit a few snags testing this on my winxp w/python2.6.1 in that getsize wasn't finding the file as it was created in two parts with .dat and .dir extension. Hrm..

Re: How to compute a delta: the difference between lists of strings

2012-05-05 Thread Emile van Sebille
On 5/5/2012 5:12 AM J. Mwebaze said... This is out of curiosity, i know this can be done with python diffllib module, but been figuring out how to compute the delta, Consider two lists below. s1 = ['e', 'f', 'g', 'A', 'B', 'C', 'D', 'C'] s2 =['e', 'A', 'B', 'f', 'g', 'C', 'D', 'z'] This is the

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-05 Thread Emile van Sebille
On 5/5/2012 4:04 AM Peng Yu said... I agree that people have different opinions on issues like this. But I think that "The Customer Is God". Readers of the doc is the customers, the writers of the doc is the producers. The opinion of customers should carry more weight than producers. Only to a

Re: __all__, public API, private stuff, and leading _

2012-05-11 Thread Emile van Sebille
On 5/11/2012 9:41 AM Ethan Furman said... Style question: Since __all__ (if defined) is the public API, if I am using that should I also still use a leading underscore on my private data/functions/etc? I would, even if only to alert any future maintainer of the internal vs exposed nature of t

Re: Good data structure for finding date intervals including a given date

2012-05-13 Thread Emile van Sebille
On 5/12/2012 5:17 AM Jean-Daniel said... Hello, I have a long list of n date intervals that gets added or suppressed intervals regularly. I am looking for a fast way to find the intervals containing a given date, without having to check all intervals (less than O(n)). ISTM the fastest way is t

Re: write a bot

2012-05-13 Thread Emile van Sebille
On 5/13/2012 2:25 PM admin lewis said... Hi, I want write a bot in python, it should explore a site, click links and extract some info. I know mechanize but I would like to know if there is something better for performance. Have you looked into Scrapy? http://scrapy.org Emile -- http://mai

Re: DIR reports file timestamp and size, but os.path.getctime(), os.path.getsize() raise WindowsError [Error 5] Access is denied

2012-05-22 Thread Emile van Sebille
On 5/21/2012 5:01 PM [email protected] said... Wondering if any of you have stumbled across the following behavior: Any ideas on how I can retrieve timestamps and file sizes like DIR without raising exceptions? Beyond the obvious trap the error and use the commands module to run DIR direct

Re: append method

2012-05-23 Thread Emile van Sebille
On 5/23/2012 5:23 AM 水静流深 said... >>> s=[1,2,3] >>> s.append(5) >>> s [1, 2, 3, 5] >>> s=s.append(5) >>> s >>> print s None why can't s=s.append(5) It could, but it doesn't. ,what is the reason? A design decision -- there's currently a mix of methods that return themselves and not

Re: Help doing it the "python way"

2012-05-24 Thread Emile van Sebille
On 5/24/2012 2:30 PM Paul Rubin said... Paul Rubin writes: new_list = chain( ((x,y-1), (x,y+1)) for x,y in coord_list ) Sorry: new_list = list(chain( ((x,y-1), (x,y+1)) for x,y in coord_list)) >>> from itertools import chain >>> coord_list = zip(range(20,30),range(30,40)) >>> a =

Re: About a list comprehension to transform an input list

2012-06-08 Thread Emile van Sebille
On 6/8/2012 9:17 AM Daniel Urban said... On Fri, Jun 8, 2012 at 6:10 PM, Julio Sergio wrote: > From a sequence of numbers, I'm trying to get a list that does something to even numbers but leaves untouched the odd ones, say: [0,1,2,3,4,...] ==> [100,1,102,3,104,...] I know that this can be d

Re: using identifiers before they are defined

2012-06-12 Thread Emile van Sebille
On 6/12/2012 10:53 AM Julio Sergio said... So I modified my module: global something a = something(5) def something(i): return i And this was the answer I got from the interpreter: ->>> import tst Traceback (most recent call last): File "", line 1, in File "tst.py

Re: finding the byte offset of an element in an XML file (tell() and seek()?)

2012-06-14 Thread Emile van Sebille
On 6/14/2012 12:27 PM Ben Temperton said... Hi there, I am working with mass spectroscopy data in the mzXML format that looks like this: ... ... ... ... . 160409990 160442725 160474927 160497386

Re: mbox parsing, specifically message body

2012-06-14 Thread Emile van Sebille
On 6/14/2012 12:57 PM Ryan Clough said... Hello everyone, Is anyone familiar with a simple way to parse mbox emails in Python? >>> import mailbox >>> help(mailbox) Help on module mailbox: NAME mailbox - Read/write support for Maildir, mbox, MH, Babyl, and MMDF mailboxes. Emile I use

Re: PIL for the Python 3.2.3

2012-06-15 Thread Emile van Sebille
On 6/15/2012 5:18 AM Gonzalo de Soto said... Dear Python Org, It wanted to know if already PIL's version is available for Python 3.2.3. Not yet. See http://www.pythonware.com/products/pil/ Emile -- http://mail.python.org/mailman/listinfo/python-list

Re: Academic citation of Python

2012-06-16 Thread Emile van Sebille
Or copy a citation from Guido: http://www.python.org/~guido/Publications.html Emile -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic Zero Padding.

2011-06-07 Thread Emile van Sebille
On 6/7/2011 2:36 PM Friedrich Clausen said... Hello All, I want to print some integers in a zero padded fashion, eg. : print("Testing %04i" % 1) Testing 0001 but the padding needs to be dynamic eg. sometimes %05i, %02i or some other padding amount. But I can't insert a variable into the form

Re: I don't know list, I not good at list.

2011-07-13 Thread Emile van Sebille
On 7/13/2011 2:13 PM Ellerbee, Edward said... I've been beating my head against the desk trying to figure out a method to accomplish this: #- My intent is to have the end data come out (from the example list above) in the forma

Re: how to get a list of all the hosts on the intranet around my workstation?

2011-07-16 Thread Emile van Sebille
On 7/16/2011 9:52 AM Chris Angelico said... On Sun, Jul 17, 2011 at 2:31 AM, Phlip wrote: pydhcplib? Shell to a DHCP utility? Ping every server in a range around my own? I'd say there's several imperfect options, and no perfect ones. 1) DHCP, which hosts may or may not be using. 2) DNS - lo

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

2011-07-28 Thread Emile van Sebille
On 7/28/2011 1:18 PM gry said... [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: ANN: geany-pyflakes 1.0

2011-08-05 Thread Emile van Sebille
On 8/5/2011 9:14 AM Filip Gruszczyński said... Hello everyone, I have just published a small plugin for Geany IDE that adds Pyflakes error detection to the editor. If there are people using Geany for Python development I would be very grateful for opinions and suggestions. The plugin can be fou

Re: ANN: geany-pyflakes 1.0

2011-08-05 Thread Emile van Sebille
On 8/5/2011 11:58 AM Filip Gruszczyński said... fyi - the downloaded geany-pyflakes-1.0.tar.gz is in fact not gzipped and should either be gizzped or simply named geany-pyflakes-1.0.tar. However, after activating the plugin, asking geany for a new file breaks geany and it rudely closes so I'm un

Re: Table Driven GUI Definition?

2011-08-05 Thread Emile van Sebille
On 8/5/2011 10:53 AM Tim Daneliuk said... I have a task where I want to create pretty simple one page visual interfaces (Graphical or Text, but it needs to run across Windows, Cygwin, Linux,*BSD, OSX ...). These interfaces are nothing more than option checklists and text fields. I'm not happen

Re: Get the name of a function

2011-08-05 Thread Emile van Sebille
On 8/5/2011 11:52 AM gervaz said... Hi all, is there a way to retrive the function name like with self.__class__.__name__? yes, but not reliably: Python 2.6.4rc2 (r264rc2:75497, Oct 20 2009, 02:55:11) [GCC 4.4.1] on linux2 Type "help", "copyright", "credits" or "license" for more information.

Re: Replace all references to one object with references to other

2011-08-05 Thread Emile van Sebille
On 8/5/2011 12:37 PM Jack Bates said... I have two objects, and I want to replace all references to the first object - everywhere - with references to the second object. What can I try? Start with a proxy to your first and have it swap in to the second? EMile -- http://mail.python.org/mailma

Re: how to separate a list into two lists?

2011-08-06 Thread Emile van Sebille
On 8/6/2011 10:07 AM smith jack said... if a list L is composed with tuple consists of two elements, that is L = [(a1, b1), (a2, b2) ... (an, bn)] is there any simple way to divide this list into two separate lists , such that L1 = [a1, a2... an] L2=[b1,b2 ... bn] >>> L = [('a1', 'b1'), ('a2'

Re: decorator issue with modules dbus & gobject

2011-08-21 Thread Emile van Sebille
On 8/18/2011 5:02 AM Makiavelik said... Hi, Here is a sample code that reproduces the issue : Not really 'sample' enough to allow others to investigate... ImportError: No module named gobject ImportError: No module named dbus ImportError: No module named dbus.mainloop.glib Try to eliminate th

Re: relative speed of incremention syntaxes (or "i=i+1" VS "i+=1")

2011-08-22 Thread Emile van Sebille
On 8/22/2011 2:55 AM Richard D. Moores said... I couldn't resist giving it a try. Using Python 3.2.1 on a 64-bit Windows 7 machine with a 2.60 gigahertz AMD Athlon II X4 620 processor, I did 18 tests, alternating between n=n+1 and n+=1 (so 9 each). The fastest for n+=1 was C:\Windows\System32>

Re: relative speed of incremention syntaxes (or "i=i+1" VS "i+=1")

2011-08-22 Thread Emile van Sebille
On 8/22/2011 9:35 AM Emile van Sebille said... On 8/22/2011 2:55 AM Richard D. Moores said... Coincidence? Naaa.. I just ran it twice -- once per ... _this_ is coincidence. :) Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Documents and Settings\Emile

Re: is there any principle when writing python function

2011-08-27 Thread Emile van Sebille
On 8/27/2011 9:41 AM Roy Smith said... Chris Angelico wrote: the important considerations are not "will it take two extra nanoseconds to execute" but "can my successor understand what the code's doing" and "will he, if he edits my code, have a reasonable expectation that he's not breaking stuf

Re: Arrange files according to a text file

2011-08-27 Thread Emile van Sebille
On 8/27/2011 10:03 AM [email protected] said... Hello, What would be the best way to accomplish this task? I'd do something like: usernames = """Adler, Jack Smith, John Smith, Sally Stone, Mark""".split('\n') filenames = """Smith, John - 02-15-75 - business files.doc Random Data - Adler J

Re: Arrange files according to a text file

2011-08-27 Thread Emile van Sebille
inside? Sure. Emile Thank you once again. On Sat, 27 Aug 2011 11:06:22 -0700, Emile van Sebille wrote: On 8/27/2011 10:03 AM [email protected] said... Hello, What would be the best way to accomplish this task? I'd do something like: usernames = """Adler, Ja

Re: is there any principle when writing python function

2011-08-27 Thread Emile van Sebille
On 8/27/2011 2:57 PM Ben Finney said... Emile van Sebille writes: Code is first and foremost written to be executed. “Programs must be written for people to read, and only incidentally for machines to execute.” —Abelson& Sussman, _Structure and Interpretation of Comp

Re: Arrange files according to a text file

2011-08-27 Thread Emile van Sebille
On 8/27/2011 4:18 PM [email protected] said... Thank you so much. The code worked perfectly. This is what I tried using Emile code. The only time when it picked wrong name from the list was when the file was named like this. Data Mark Stone.doc How can I fix this? Hope I am not asking too mu

Re: How to save the packages received by a network interface or some port in a file and resend the packages received when needed?

2011-08-31 Thread Emile van Sebille
On 8/31/2011 6:35 AM [email protected] said... hi, This is a question not specific to Python,but its related somehow,and I believe I can get some help from your fellow:) I am doing my work on a server service program on Linux that processes the packages sent to the socket it listens.Their

Re: Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread Emile van Sebille
On 8/31/2011 7:35 AM T. Goodchild said... Just curious about the rationale behind this part of the language. http://docs.python.org/faq/design.html -- http://mail.python.org/mailman/listinfo/python-list

Re: How to save the packages received by a network interface or some port in a file and resend the packages received when needed?

2011-08-31 Thread Emile van Sebille
On 8/31/2011 8:37 AM [email protected] said... In fact,UDP is enough for me,I heared that tcpdump and netcat can store and resend the udp packages to get the replay effect,but I don't know how, That may be, but I've never tried that. or is there some better way? I am working on a Linux ser

Re: PEP 20 - Silly Question?

2011-09-07 Thread Emile van Sebille
On 9/6/2011 6:31 PM Joshua Miller said... You sure it wasn't the invisible one? you know the one in the white text that blends into the background? Aah! So _that's_ significant whitespace! :) Emile -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   >