Re: Python 3 crashes with 'Py_Initialize: can't initialize sys standard streams' + 'EOFError: EOF read where not expected'

2012-09-25 Thread Oscar Benjamin
On 25 September 2012 14:56, Robison Santos wrote: > I'm using python3.2.1 > on Enterprise Linux Server release 5.3 (Carthage). > > I'm starting my apps calling python3 file.py > > I have a script that runs on system startup executing my python scripts. > What happens if you just run the script

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Oscar Benjamin
On 25 September 2012 19:08, Junkshops wrote: > > Can you give an example of how these data structures look after reading > only the first 5 lines? > > Sure, here you go: > > In [38]: mpef._ustore._store > Out[38]: defaultdict(, {'Measurement': > {'8991c2dc67a49b909918477ee4efd767': > , > '7b38b4

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Oscar Benjamin
On 25 September 2012 21:26, Junkshops wrote: > On 9/25/2012 11:17 AM, Oscar Benjamin wrote: > > On 25 September 2012 19:08, Junkshops wrote: > >> >> In [38]: mpef._ustore._store >> Out[38]: defaultdict(, {'Measurement'

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Oscar Benjamin
On 25 September 2012 23:09, Ian Kelly wrote: > On Tue, Sep 25, 2012 at 12:17 PM, Oscar Benjamin > wrote: > > Also I think lambda functions might be able to keep the frame alive. Are > > they by any chance being created in a function that is called in a loop? > > I&

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Oscar Benjamin
On 25 September 2012 23:10, Tim Chase wrote: > On 09/25/12 16:17, Oscar Benjamin wrote: > > I don't know whether it would be better or worse but it might be > > worth seeing what happens if you replace the FileContext objects > > with tuples. > > If tuples pro

Re: Need to archive a MySQL database using a python script

2012-09-25 Thread Oscar Benjamin
On 26 September 2012 00:17, wrote: > Python Users Group, > > I need to archive a MySQL database using a python script. > I found a good example at: https://gist.github.com/3175221 > > The following line executes however, the archive file is empty. > > os.popen("mysqldump -u %s -p%s -h %s -e --opt

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Oscar Benjamin
On 26 September 2012 00:35, Tim Chase wrote: > On 09/25/12 17:55, Oscar Benjamin wrote: > > On 25 September 2012 23:10, Tim Chase > wrote: > >> If tuples provide a savings but you find them opaque, you might also > >> consider named-tuples for clarity. > > &g

[python-list] python application file format

2012-09-26 Thread Benjamin Jessup
Hello all, What do people recommend for a file format for a python desktop application? Data is complex with 100s/1000s of class instances, which reference each other. Write the file with struct module? (Rebuild object pointers, safe, compact, portable, not expandable without reserved space)

Re: How to get progress in python script.

2012-09-30 Thread Oscar Benjamin
On 28 September 2012 17:26, Rolando Cañer Roblejo wrote: > Hi all, > > Please, I need you suggest me a way to get statistics about a progress of > my python script. My python script could take a lot of time processing a > file, so I need a way that an external program check the progress of the > s

Re: Can't import modules

2012-09-30 Thread Benjamin Kaplan
On Sun, Sep 30, 2012 at 12:42 PM, Peter Farrell wrote: > Hello! > > I'm still new to Python, so here's another easy one. After I save something > I've done as a .py file, how do I import it into something else I work on? > Every time I try to import something other than turtle or math, I get thi

Re: unit testing class hierarchies

2012-10-03 Thread Oscar Benjamin
On 3 October 2012 02:20, Steven D'Aprano wrote: > > But surely, regardless of where that functionality is defined, you still > need to test that both D1 and D2 exhibit the correct behaviour? Otherwise > D2 (say) may break that functionality and your tests won't notice. > > Given a class hierarchy

Re: Combinations of lists

2012-10-03 Thread Oscar Benjamin
On 3 October 2012 15:26, Steen Lysgaard wrote: > Hi, > > I am looking for a clever way to compute all combinations of two lists. Look > at this example: > > h = ['A','A','B','B'] > m = ['a','b'] > > the resulting combinations should be of the same length as h and each > element in m can be used tw

Re: Combinations of lists

2012-10-03 Thread Oscar Benjamin
Oscar wrote: >>> def uniquecombinations(h, m): >>> for ha in submultisets(h, len(h)//2): >>> hb = list(h) >>> for c in ha: >>> hb.remove(c) >>> yield [m[0] + a for a in ha] + [m[1] + b for b in hb] >>> >>> h = ['A', 'A', 'B', 'B'] >>> m = ['a', 'b'] >>> >>> f

fastest data structure for retrieving objects identified by (x,y) tuple?

2012-10-03 Thread Benjamin Jessup
I have a group of objects identified by unique (x,y) pairs and I want to find out an object's "neighbors" in a matrix of size 2400 x 2400. # #obj# # # # # # #obj# 3 x 3 Example # # # # # ##

Re: fastest data structure for retrieving objects identified by (x, y) tuple?

2012-10-04 Thread Oscar Benjamin
On Oct 4, 2012 3:02 AM, "Steven D'Aprano" < steve+comp.lang.pyt...@pearwood.info> wrote: > # populate a random matrix using both dict and list > adict = {} > alist = [[None]*2400 for i in range(2400)] > from random import randrange > for i in range(1000): > x = randrange(2400) > y = randran

Re: final question: logging to stdout and updating files

2012-10-04 Thread Oscar Benjamin
On 4 October 2012 04:11, Littlefield, Tyler wrote: > pHello all: > I've seen frameworks like django reload files when it detects that they've > been changed; how hard would it be to make my engine reload files that it > detects were changed? I tend to think that it's better to reload things expli

Re: Python-list Digest, Vol 109, Issue 20

2012-10-04 Thread Benjamin Jessup
On 10/4/2012 12:20 AM, python-list-requ...@python.org wrote: How do you know that? No offence, but if you can't even work out whether lookups in a dict or a list are faster, I can't imagine why you think you can intuit what the fastest way to retrieve the nearest neighbours would be. Whats wro

Re: fastest data structure for retrieving objects identified by (x, y) tuple?

2012-10-04 Thread Benjamin Jessup
On 10/4/2012 12:20 AM, python-list-requ...@python.org wrote: How do you know that? No offence, but if you can't even work out whether lookups in a dict or a list are faster, I can't imagine why you think you can intuit what the fastest way to retrieve the nearest neighbours would be. Whats wro

Re: Why is pylaucher in Python 3.3 being installed in Windows folder?

2012-10-04 Thread Oscar Benjamin
On 4 October 2012 16:51, Ian Kelly wrote: > On Thu, Oct 4, 2012 at 8:41 AM, Piotr Dobrogost > wrote: >> Now, the question is why not put pylauncher together with python.exe >> now, when 3.3 has an option to add Python's folder to the PATH? In >> case there are more than one Python installed this

Re: calendar from python to html

2012-10-05 Thread Jason Benjamin
Well, you need a web server, a webpage, a database (could just be a file), a cgi script, and the datetime module. Optionally, you can use a web framework like CherryPy or Django, which covers a lot of these by itself. I only know Python 2, but here are some examples: A basic web server: web

Re: getting the state of an object

2012-10-07 Thread Oscar Benjamin
On Oct 7, 2012 9:57 AM, "Franck Ditter" wrote: > > Hi ! > > Another question. When writing a class, I have often to > destructure the state of an object as in : > > def foo(self) : > (a,b,c,d) = (self.a,self.b,self.c,self.d) > ... big code with a,b,c,d ... > What's wrong with the above? I

Re: Feedback on my python framework I'm building.

2012-10-13 Thread Oscar Benjamin
On 13 October 2012 17:48, Chris Angelico wrote: > > The only way to support *absolutely everything* is to do nothing - to > be a framework so thin you're invisible. (That's not to say you're > useless; there are bridge modules that do exactly this - ctypes can > call on any library function from P

Re: python game develop:framework?

2012-10-14 Thread Jason Benjamin
Pygame is my favorite. It's mature, has good documentation, and has lots of unfinished and finished games on its website. It also supports OpenGL. http://www.pygame.org/ On 10/14/2012 01:58 AM, nepaul wrote: Something good framwork? -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't run any script without it failing due to calling tkinter for no reason

2012-10-14 Thread Benjamin Kaplan
On Sun, Oct 14, 2012 at 6:47 PM, wrote: > Hello All, > > > I'm running python 3.2 on Freebsd 9.0 Release and I must've screwed up my > environment somehow, because now I can't run any script without it failing > and throwing: > ** IDLE can't import Tkinter. Your Python may not be configured fo

Re: Aggressive language on python-list

2012-10-17 Thread Oscar Benjamin
On 17 October 2012 19:16, Chris Angelico wrote: > On Thu, Oct 18, 2012 at 3:48 AM, wrote: >>On 10/16/2012 08:45 PM, Steven D'Aprano wrote: >>> Except that you've made a 180- >>> degree turn from your advice to "ignore" bad behaviour, but apparently >>> didn't notice that *sending private emails*

Re: list comprehension question

2012-10-17 Thread Oscar Benjamin
On 17 October 2012 06:09, Dwight Hutto wrote: > On Wed, Oct 17, 2012 at 12:43 AM, Kevin Anthony > wrote: >> Is it not true that list comprehension is much faster the the for loops? >> >> If it is not the correct way of doing this, i appoligize. >> Like i said, I'm learing list comprehension. >> >

Re: Aggressive language on python-list

2012-10-17 Thread Oscar Benjamin
On 18 October 2012 00:17, Steven D'Aprano wrote: > On Wed, 17 Oct 2012 14:10:34 -0700, rurpy wrote: > >> On 10/17/2012 02:28 PM, Oscar Benjamin wrote:> On 17 October 2012 19:16, >> Chris Angelico wrote: >>>> On Thu, Oct 18, 2012 at 3:48 AM, wrote: >&g

Re: locking files on Linux

2012-10-18 Thread Oscar Benjamin
On 18 October 2012 14:44, andrea crotti wrote: > 2012/10/18 Grant Edwards : >> On 2012-10-18, andrea crotti wrote: >> >> >> File locks under Unix have historically been "advisory". That means >> that programs have to _choose_ to pay attention to them. Most >> programs do not. >> >> Linux does s

Re: Inheritance Question

2012-10-18 Thread Oscar Benjamin
On 18 October 2012 15:10, Jeff Jeffries wrote: > Hello everybody > > When I set "AttributeChanges" in my example, it sets the same value for all > other subclasses. Can someone help me with what the name of this behavior is > (mutable class global?) ? I don't know any keywords... having troub

Re: locking files on Linux

2012-10-18 Thread Oscar Benjamin
On 18 October 2012 15:49, andrea crotti wrote: > 2012/10/18 Grant Edwards : >> >> If what you're guarding against is multiple instances of your >> application modifying the file, then either of the advisory file >> locking schemes or the separate lock file should work fine. > > Ok so I tried a sma

Re: locking files on Linux

2012-10-18 Thread Oscar Benjamin
On 18 October 2012 16:08, andrea crotti wrote: > 2012/10/18 Oscar Benjamin : >> >> Why not come up with a test that actually shows you if it works? Here >> are two suggestions: >> >> 1) Use time.sleep() so that you know how long the lock is held for. >> 2)

Re: Fast forward-backward (write-read)

2012-10-23 Thread Oscar Benjamin
On 23 October 2012 15:31, Virgil Stokes wrote: > I am working with some rather large data files (>100GB) that contain time > series data. The data (t_k,y(t_k)), k = 0,1,...,N are stored in ASCII > format. I perform various types of processing on these data (e.g. moving > median, moving average, an

Re: Fast forward-backward (write-read)

2012-10-28 Thread Oscar Benjamin
On 28 October 2012 14:20, Virgil Stokes wrote: > On 28-Oct-2012 12:18, Dave Angel wrote: >> >> On 10/24/2012 03:14 AM, Virgil Stokes wrote: >>> >>> On 24-Oct-2012 01:46, Paul Rubin wrote: Virgil Stokes writes: > > Yes, I do wish to inverse the order, but the "forward in time" f

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Benjamin Kaplan
On Mon, Oct 29, 2012 at 9:33 AM, Johannes Bauer wrote: > Hi there, > > I'm currently looking for a good solution to the following problem: I > have two classes A and B, which interact with each other and which > interact with the user. Instances of B are always created by A. > > Now I want A to ca

Re: Numpy module

2012-10-29 Thread Benjamin Kaplan
On Sun, Oct 28, 2012 at 10:40 PM, wrote: > Hello to the group! > > I've learned a lot about Ubuntu just trying to install numpy for Python > 3.2.3. I've finally managed to put it in the Python3.2 directory but when I > try to import it, I still get there's "no module named numpy." There are >

Re: Negative array indicies and slice()

2012-10-29 Thread Oscar Benjamin
On 29 October 2012 23:01, Ian Kelly wrote: > On Mon, Oct 29, 2012 at 9:20 AM, Andrew Robinson > wrote: >> FYI: I was asking for a reason why Python's present implementation is >> desirable... >> >> I wonder, for example: >> >> Given an arbitrary list: >> a=[1,2,3,4,5,6,7,8,9,10,11,12] >> >> Why w

Proper place for everything

2012-11-02 Thread Jason Benjamin
Anybody know of the appropriate place to troll and flame about various Python related issues? I'm kind of mad about some Python stuff and I need a place to vent where people may or may not listen, but at at least respond. Thought this would be a strange question, but I might as well start som

Re: Proper place for everything

2012-11-02 Thread Jason Benjamin
Yeah, alright. I've just found that if you mention anything about a library that has well established competitors, the post will tend to get ignored here. On 11/02/2012 04:38 AM, Robert Kern wrote: On 11/2/12 11:20 AM, Jason Benjamin wrote: Anybody know of the appropriate place to trol

Re: Proper place for everything

2012-11-02 Thread Jason Benjamin
d, but I stereotype. On 11/02/2012 10:31 AM, Dennis Lee Bieber wrote: On Fri, 02 Nov 2012 06:49:18 -0700, Jason Benjamin declaimed the following in gmane.comp.python.general: Yeah, alright. I've just found that if you mention anything about a library that has well established competitors,

Re: Proper place for everything

2012-11-02 Thread Jason Benjamin
27;ve ever used. On 11/02/2012 10:31 AM, Dennis Lee Bieber wrote: On Fri, 02 Nov 2012 06:49:18 -0700, Jason Benjamin declaimed the following in gmane.comp.python.general: Yeah, alright. I've just found that if you mention anything about a library that has well established competitors, the po

Re: Proper place for everything

2012-11-02 Thread Jason Benjamin
Yeah, now that I take a look at the said old post on this group, I can see why the post was ignored: http://markmail.org/thread/mnxpzt4jzx3zjeio On 11/02/2012 01:05 PM, Tim Golden wrote: On 02/11/2012 18:51, Jason Benjamin wrote: On another note, it appears that Google (the only archive I

Re: is implemented with id ?

2012-11-03 Thread Oscar Benjamin
On 3 November 2012 22:50, Chris Angelico wrote: > This one I haven't checked the source for, but ISTR discussions on > this list about comparison of two unequal interned strings not being > optimized, so they'll end up being compared char-for-char. Using 'is' > guarantees that the check stops with

Re: Multi-dimensional list initialization

2012-11-05 Thread Oscar Benjamin
On 5 November 2012 09:13, Hans Mulder wrote: > On 5/11/12 07:27:52, Demian Brecht wrote: >> So, here I was thinking "oh, this is a nice, easy way to initialize a 4D >> matrix" >> (running 2.7.3, non-core libs not allowed): >> >> m = [[None] * 4] * 4 >> >> The way to get what I was after was: >> >

Re: Multi-dimensional list initialization

2012-11-05 Thread Oscar Benjamin
On 6 November 2012 02:01, Chris Angelico wrote: > On Tue, Nov 6, 2012 at 12:32 PM, Oscar Benjamin > wrote: >> I was just thinking to myself that it would be a hard thing to change >> because the list would need to know how to instantiate copies of all >> the different

Re: Multi-dimensional list initialization

2012-11-06 Thread Oscar Benjamin
On Nov 6, 2012 6:00 AM, "Andrew Robinson" wrote: > > On 11/05/2012 06:30 PM, Oscar Benjamin wrote: >> >> stuff = [[obj] * n] * m >> >> I thought that the multiplication of the inner list ([obj] * n) by m >> could create a new list of lists using

Re: Multi-dimensional list initialization

2012-11-07 Thread Oscar Benjamin
On Nov 7, 2012 5:41 AM, "Gregory Ewing" wrote: > > If anything is to be done in this area, it would be better > as an extension of list comprehensions, e.g. > > [[None times 5] times 10] > > which would be equivalent to > > [[None for _i in xrange(5)] for _j in xrange(10)] I think you're righ

Re: Multi-dimensional list initialization

2012-11-07 Thread Oscar Benjamin
On 7 November 2012 13:39, Joshua Landau wrote: > > On 7 November 2012 11:11, Oscar Benjamin wrote: >> >> A more modest addition for the limited case described in this thread could >> be to use exponentiation: >> >> >>> [0] ** (2, 3) >> [

Re: Multi-dimensional list initialization

2012-11-07 Thread Oscar Benjamin
On Nov 7, 2012 3:55 PM, "Ethan Furman" wrote: > > Oscar Benjamin wrote: >> >> A more modest addition for the limited case described in this thread could be to use exponentiation: >> >> >>> [0] ** (2, 3) >> [[0, 0, 0], [0, 0, 0]] > > &g

Re: Multi-dimensional list initialization

2012-11-07 Thread Oscar Benjamin
On 7 November 2012 22:16, Joshua Landau wrote: > On 7 November 2012 14:00, Oscar Benjamin wrote: >> On 7 November 2012 13:39, Joshua Landau >> wrote: >> > On 7 November 2012 11:11, Oscar Benjamin >> > wrote: >> >> A more modest addition for the limi

Re: creating size-limited tar files

2012-11-07 Thread Oscar Benjamin
On 7 November 2012 21:52, Andrea Crotti wrote: > On 11/07/2012 08:32 PM, Roy Smith wrote: >> >> In article <509ab0fa$0$6636$9b4e6...@newsspool2.arcor-online.net>, >> Alexander Blinne wrote: >> >>> I don't know the best way to find the current size, I only have a >>> general remark. >>> This sol

Re: Right solution to unicode error?

2012-11-07 Thread Oscar Benjamin
On 7 November 2012 22:17, Anders wrote: > > Traceback (most recent call last): > File "outlook_tasks.py", line 66, in > my_tasks.dump_today_tasks() > File "C:\Users\Anders\code\Task List\tasks.py", line 29, in > dump_today_tasks > print task.subject > UnicodeEncodeError: 'ascii' codec

Re: Multi-dimensional list initialization

2012-11-07 Thread Oscar Benjamin
On 8 November 2012 00:00, Steven D'Aprano wrote: > Andrew, it appears that your posts are being eaten or rejected by my > ISP's news server, because they aren't showing up for me. Possibly a side- > effect of your dates being in the distant past? So if you have replied to > any of my posts, I have

Re: Right solution to unicode error?

2012-11-07 Thread Oscar Benjamin
On 7 November 2012 23:51, Andrew Berg wrote: > On 2012.11.07 17:27, Oscar Benjamin wrote: >> Are you using cmd.exe (standard Windows terminal)? If so, it does not >> support unicode > Actually, it does. Code page 65001 is UTF-8. I know that doesn't help > the OP since

Re: Right solution to unicode error?

2012-11-08 Thread Oscar Benjamin
On 8 November 2012 00:44, Oscar Benjamin wrote: > On 7 November 2012 23:51, Andrew Berg wrote: >> On 2012.11.07 17:27, Oscar Benjamin wrote: >>> Are you using cmd.exe (standard Windows terminal)? If so, it does not >>> support unicode >> Actually, it does. Code

Re: Right solution to unicode error?

2012-11-08 Thread Oscar Benjamin
On 8 November 2012 15:05, wrote: > Le jeudi 8 novembre 2012 15:07:23 UTC+1, Oscar Benjamin a écrit : >> On 8 November 2012 00:44, Oscar Benjamin wrote: >> > On 7 November 2012 23:51, Andrew Berg wrote: >> >> On 2012.11.07 17:27, Oscar Benjamin wrote: >> &g

Re: Right solution to unicode error?

2012-11-08 Thread Oscar Benjamin
On 8 November 2012 19:54, wrote: > Le jeudi 8 novembre 2012 19:49:24 UTC+1, Ian a écrit : >> On Thu, Nov 8, 2012 at 11:32 AM, Oscar Benjamin >> >> wrote: >> >> > If I want the other characters to work I need to change the code page: >> >> > >

Re: Python3.3 str() bug?

2012-11-10 Thread Oscar Benjamin
On 9 November 2012 11:08, Helmut Jarausch wrote: > On Fri, 09 Nov 2012 10:37:11 +0100, Stefan Behnel wrote: > >> Helmut Jarausch, 09.11.2012 10:18: >>> probably I'm missing something. >>> >>> Using str(Arg) works just fine if Arg is a list. >>> But >>> str([],encoding='latin-1') >>> >>> gives

Re: Method default argument whose type is the class not yet defined

2012-11-10 Thread Oscar Benjamin
On 10 November 2012 19:33, Jennie wrote: > What is the best solution to solve the following problem in Python 3.3? > > import math class Point: > ... def __init__(self, x=0, y=0): > ... self.x = x > ... self.y = y > ... def __sub__(self, other): > ... return Po

Re: Method default argument whose type is the class not yet defined

2012-11-11 Thread Oscar Benjamin
On 11 November 2012 02:47, Chris Angelico wrote: > On Sun, Nov 11, 2012 at 1:43 PM, Ian Kelly wrote: >> On Sat, Nov 10, 2012 at 7:13 PM, Chris Angelico wrote: >>> I would not assume that. The origin is a point, just like any other. >>> With a Line class, you could deem a zero-length line to be l

Re: Method default argument whose type is the class not yet defined

2012-11-11 Thread Oscar Benjamin
On 11 November 2012 22:31, Steven D'Aprano wrote: > On Sun, 11 Nov 2012 14:21:19 +, Oscar Benjamin wrote: > >> On 11 November 2012 02:47, Chris Angelico wrote: >>> On Sun, Nov 11, 2012 at 1:43 PM, Ian Kelly >>> wrote: >>>> On Sat, Nov 10, 2012

Re: Method default argument whose type is the class not yet defined

2012-11-11 Thread Oscar Benjamin
On 12 November 2012 01:10, Mark Lawrence wrote: > On 12/11/2012 00:31, Oscar Benjamin wrote: >> >> >> Plain wrong. Vectors are not defined *from any origin*. >> > > So when the Captain says "full speed ahead, steer 245 degrees", you haven't > the

Re: Method default argument whose type is the class not yet defined

2012-11-11 Thread Oscar Benjamin
On 12 November 2012 01:29, Mark Lawrence wrote: > On 12/11/2012 01:18, Oscar Benjamin wrote: >> >> On 12 November 2012 01:10, Mark Lawrence wrote: >>> >>> On 12/11/2012 00:31, Oscar Benjamin wrote: >>>> >>>> Plain wrong. Vectors are not de

Re: Passing functions as parameter (multiprocessing)

2012-11-13 Thread Oscar Benjamin
On 13 November 2012 12:51, Peter Otten <__pete...@web.de> wrote: > Jean-Michel Pichavant wrote: > >> I'm having problems understanding an issue with passing function as >> parameters. > >> Here's a code that triggers the issue: >> >> >> import multiprocessing >> >> def f1(): >> print 'I am f1'

Re: Robust regex

2012-11-19 Thread Benjamin Kaplan
On Nov 19, 2012 12:37 PM, "Joseph L. Casale" wrote: > > Trying to robustly parse a string that will have key/value pairs separated > by three pipes, where each additional key/value (if more than one exists) > will be delineated by four more pipes. > > string = 'key_1|||value_1key_2|||value

The curses module and licensing

2012-12-06 Thread Benjamin Schnitzler
rminal interface for some GPL software project. Can You give me a hint, if that is possible (yes, I know, You are no lawyers) and if and where I have to include licensing informations regarding the license of curses/ncurses ? Thank You Benjamin -- http://mail.python.org/mailman/listinfo/python-list

Re: The curses module and licensing

2012-12-06 Thread benjamin schnitzler
years, which was in 1998, so it might not be relevant at all. Well ok. I guess I can just leave my files, as they are, since they are no real extensions of the library. But I am not completely sure. If anyone has a better idea: Just let me know it. Benjamin On Thu, Dec 6, 2012 at 4:02 PM, Ben

The curses module and licensing

2012-12-06 Thread Benjamin Schnitzler
On 19:28 Thu 06 Dec , Alister wrote: > If I understand things correctly this means if you distribute the python > package (alone or as part of your application) then you need to include > the detailed section. > > if you provide just your own python code & require the user to install > pyth

Re: Matplotlib/Pylab Error

2012-12-11 Thread Oscar Benjamin
On 10 December 2012 20:40, wrote: > Dear Group, > > I am trying to enumerate few interesting errors on pylab/matplotlib. > If any of the learned members can kindly let me know how should I address > them. > > I am trying to enumerate them as follows. > > i) >>> import numpy import pylab >>>

Re: How to import module whose filename starts number

2012-12-12 Thread Benjamin Kaplan
On Dec 12, 2012 9:47 AM, "Yong Hu" wrote: > > I have a few scripts whose file names start with numbers. For example, 01_step1.py, 02_step2.py > > I tried to import them in another script by "import 01_step1" or "from 01_step1 import *". Both failed, saying "SyntaxError: invalid syntax" > > Is ther

Re:

2012-12-15 Thread Benjamin Kaplan
On Sat, Dec 15, 2012 at 5:49 PM, Dustin Guerri wrote: > > Hi there, > > I'm new to Python and to programming. is this the right place for me to > post a beginner question on Python use ? > > Many thanks. > You could post questions here, but it would be better to use the Python-tutor list for tha

Re: Unicode

2012-12-17 Thread Benjamin Kaplan
On Mon, Dec 17, 2012 at 12:59 AM, Anatoli Hristov wrote: >> What happens when you do use UTF-8? > This is the result when I encode the string: > " étroits, en utilisant un portable extrêmement puissant—le plus > petit et le plus léger des HP EliteBook pleine puissance—avec un > écran de di

Re: Iterating over files of a huge directory

2012-12-17 Thread Oscar Benjamin
On 17 December 2012 15:28, Gilles Lenfant wrote: > I have googled but did not find an efficient solution to my problem. My > customer provides a directory with a hge list of files (flat, potentially > 10+) and I cannot reasonably use os.listdir(this_path) unless creating a > big memory

Re: os.system and subprocess odd behavior

2012-12-17 Thread Oscar Benjamin
On 17 December 2012 16:39, py_genetic wrote: > Thanks for verifying this for me Steven. I'm glad you are seeing it work. > It's really the strangest thing. > > The issue seems to be with the " > outfile.txt" portion of the command. > > The actual command is running a query on a verticalDB and d

Re: Delete dict and subdict items of some name

2012-12-17 Thread Oscar Benjamin
On 17 December 2012 17:27, Gnarlodious wrote: > Hello. What I want to do is delete every dictionary key/value of the name > 'Favicon' regardless of depth in subdicts, of which there are many. What is > the best way to do it? You might need to be a bit clearer about what you mean by subdicts. I

Re: Re: Iterating over files of a huge directory

2012-12-17 Thread Oscar Benjamin
On 17 December 2012 18:40, Evan Driscoll wrote: > On 12/17/2012 09:52 AM, Oscar Benjamin wrote: >> https://github.com/benhoyt/betterwalk > > This is very useful to know about; thanks. > > I actually wrote something very similar on my own (I wanted to get > information abou

Re: Delete dict and subdict items of some name

2012-12-17 Thread Oscar Benjamin
On 17 December 2012 23:44, Oscar Benjamin wrote: > On 17 December 2012 23:08, MRAB wrote: >> Wouldn't a set of the id of the visited objects work? > > Of course it would. This is just a tree search. > > Here's a depth-first-search function: > > def dfs(r

Re: os.system and subprocess odd behavior

2012-12-17 Thread Oscar Benjamin
On 17 December 2012 20:56, py_genetic wrote: > Oscar, seems you may be correct. I need to run this program as a superuser. > However, after some more tests with simple commands... I seem to be working > correctly from any permission level in python Except for the output write > command f

Re: Delete dict and subdict items of some name

2012-12-17 Thread Oscar Benjamin
On 17 December 2012 23:08, MRAB wrote: > On 2012-12-17 22:00, Dave Angel wrote: >> On 12/17/2012 04:33 PM, Mitya Sirenef wrote: >>> On 12/17/2012 01:30 PM, Tim Chase wrote: On 12/17/12 11:43, Mitya Sirenef wrote: > On 12/17/2012 12:27 PM, Gnarlodious wrote: >> >> Hello. What I wan

Re: os.system and subprocess odd behavior

2012-12-18 Thread Oscar Benjamin
Can you trim content and interleave your response (instead of top-posting) please? On 18 December 2012 18:26, py_genetic wrote: > HOWEVER... > > when using this command from before no dice > > /usr/local/Calpont/mysql/bin/mysql > --defaults-file=/usr/local/Calpont/mysql/my.cnf -u root myDB <

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Benjamin Peterson
gmail.com> writes: > I really, really do not know what I should think about that. > (It is a complex subject.) And the real question is why? Because that's what the Unicode spec says to do. -- http://mail.python.org/mailman/listinfo/python-list

Re: how to detect the encoding used for a specific text data ?

2012-12-21 Thread Oscar Benjamin
On 20 December 2012 11:57, iMath wrote: > how to detect the encoding used for a specific text data ? Normally encoding is given in some way by the context of the data. Otherwise no general solution is possible. On a related note: how to answer question with no context on mailing list? -- http:

Re: compile python 3.3 with bz2 support

2012-12-22 Thread Benjamin Kaplan
On Dec 21, 2012 1:31 AM, "Isml" <76069...@qq.com> wrote: > > hi, everyone: > I want to compile python 3.3 with bz2 support on RedHat 5.5 but fail to do that. Here is how I do it: > 1. download bzip2 and compile it(make、make -f Makefile_libbz2_so、make install) > 2.chang to python 3.3 sou

Re: 3.2 can't extract tarfile produced by 2.7

2012-12-26 Thread Benjamin Kaplan
On Dec 26, 2012 11:00 AM, "Antoon Pardon" wrote: > > I am converting some programs to python 3. These programs manipulate tarfiles. In order for the python3 programs to be really useful > they need to be able to process the tarfiles produced by python2 that however seems to be a problem. > > This

Re: Command Line Progress Bar

2012-12-27 Thread Oscar Benjamin
On 26 December 2012 06:17, Kevin Anthony wrote: > Hello, > I'm writing a file processing script(Linux), and i would like to have a > progress bar. But i would also like to be able to print messages. Is there > a simple way of doing this without implementing something like ncurses? Other project

Re: Function Parameters

2012-12-27 Thread Oscar Benjamin
On 27 December 2012 20:47, Joseph L. Casale wrote: >> Don't use kwargs for this. List out the arguments in the function >> spec and give the optional ones reasonable defaults. > >> I only use kwargs myself when the set of possible arguments is dynamic >> or unknown. > > Gotch ya, but when the inp

Re: Yet another attempt at a safe eval() call

2013-01-05 Thread Oscar Benjamin
On 4 January 2013 15:53, Grant Edwards wrote: > On 2013-01-04, Steven D'Aprano wrote: >> On Thu, 03 Jan 2013 23:25:51 +, Grant Edwards wrote: >> >> * But frankly, you should avoid eval, and write your own mini-integer >> arithmetic evaluator which avoids even the most remote possibility >>

Re: Random List Loop?!

2013-01-05 Thread Oscar Benjamin
On 5 January 2013 15:47, Christian Gabriel wrote: > Hi > > I have tried now for ages to make a loop that does the following: > > Makes a new list with 9 random values, from 9 different lists, with 9 > elements. > > And makes sure that none of the elements repeat! > > Is there anyone that can help

Re: Yet another attempt at a safe eval() call

2013-01-05 Thread Oscar Benjamin
On 5 January 2013 16:01, Chris Angelico wrote: > On Sun, Jan 6, 2013 at 2:56 AM, Oscar Benjamin > wrote: >> On 4 January 2013 15:53, Grant Edwards wrote: >>> On 2013-01-04, Steven D'Aprano wrote: >>>> On Thu, 03 Jan 2013 23:25:51 +, Grant Edwards wrot

Re: How do you call a function several times in this context??

2013-01-06 Thread Benjamin Kaplan
On Jan 6, 2013 12:33 PM, "kofi" wrote: > > Using python 3.1, I have written a function called "isEvenDigit" > > Below is the code for the "isEvenDigit" function: > > def isEvenDigit(): > ste=input("Please input a single character string: ") > li=["0","2","4", "6", "8"] > if ste in li:

Re: Yet another attempt at a safe eval() call

2013-01-06 Thread Oscar Benjamin
On 6 January 2013 15:12, Grant Edwards wrote: > On 2013-01-05, Oscar Benjamin wrote: >> On 4 January 2013 15:53, Grant Edwards wrote: >>> On 2013-01-04, Steven D'Aprano wrote: >>>> On Thu, 03 Jan 2013 23:25:51 +, Grant Edwards wrote: >>>>

Re: Numpy outlier removal

2013-01-06 Thread Oscar Benjamin
On 7 January 2013 01:46, Steven D'Aprano wrote: > On Sun, 06 Jan 2013 19:44:08 +, Joseph L. Casale wrote: > >> I have a dataset that consists of a dict with text descriptions and >> values that are integers. If required, I collect the values into a list >> and create a numpy array running it t

Re: Numpy outlier removal

2013-01-07 Thread Oscar Benjamin
On 7 January 2013 05:11, Steven D'Aprano wrote: > On Mon, 07 Jan 2013 02:29:27 +, Oscar Benjamin wrote: > >> On 7 January 2013 01:46, Steven D'Aprano >> wrote: >>> On Sun, 06 Jan 2013 19:44:08 +, Joseph L. Casale wrote: >>> >>> I&#x

Re: [Offtopic] Line fitting [was Re: Numpy outlier removal]

2013-01-07 Thread Oscar Benjamin
On 7 January 2013 17:58, Steven D'Aprano wrote: > On Mon, 07 Jan 2013 15:20:57 +, Oscar Benjamin wrote: > >> There are sometimes good reasons to get a line of best fit by eye. In >> particular if your data contains clusters that are hard to separate, >> sometimes

Re: Searching through two logfiles in parallel?

2013-01-07 Thread Oscar Benjamin
On 7 January 2013 22:10, Victor Hooi wrote: > Hi, > > I'm trying to compare two logfiles in Python. > > One logfile will have lines recording the message being sent: > > 05:00:06 Message sent - Value A: 5.6, Value B: 6.2, Value C: 9.9 > > the other logfile has line recording the message being

Re: Searching through two logfiles in parallel?

2013-01-07 Thread Oscar Benjamin
gt; > In reality, I'd need to handle missing messages in logfile2, but that's the > general idea. > > Does that make sense? (There's also a chance I've misunderstood your buf > code, and it does do this - in that case, I apologies - is there any chance > you

Re: Calculate Big Number

2013-01-07 Thread Oscar Benjamin
On 8 January 2013 00:44, Nac Temha wrote: > Hello, > How to quickly calculate large numbers. For example (10**25) * (2**50) > 11258999068426240L I just tested that line in the interpreter and it ran so quickly it seemed instantaneous (maybe my computer is faster than

Re: [Offtopic] Line fitting [was Re: Numpy outlier removal]

2013-01-08 Thread Oscar Benjamin
On 8 January 2013 01:23, Steven D'Aprano wrote: > On Mon, 07 Jan 2013 22:32:54 +, Oscar Benjamin wrote: > > [...] >> I also think it would >> be highly foolish to go so far with refusing to eyeball data that you >> would accept the output of some regression a

Re: How to tell how many weeks apart two datetimes are?

2013-01-08 Thread Oscar Benjamin
On 8 January 2013 22:50, MRAB wrote: > On 2013-01-08 21:22, Roy Smith wrote: >> >> How do you tell how many weeks apart two datetimes (t1 and t2) are? >> The "obvious" solution would be: >> >> weeks = (t2 - t1) / timedelta(days=7) >> >> but that doesn't appear to be allowed. Is there some fundame

Re: Searching through two logfiles in parallel?

2013-01-08 Thread Oscar Benjamin
On 8 January 2013 19:16, darnold wrote: > i don't think in iterators (yet), so this is a bit wordy. > same basic idea, though: for each message (set of parameters), build a > list of transactions consisting of matching send/receive times. The advantage of an iterator based solution is that we can

Re: wiki.python.org

2013-01-09 Thread Benjamin Kaplan
On Wed, Jan 9, 2013 at 8:30 AM, Ken wrote: > On Wed, Jan 09, 2013 at 04:05:31PM +, Reed, Kevin wrote: >> Hello, >> >> I have been unable to access wiki.python.org for two days. Is there a >> problem with the server, or is it me? >> >> Thank you much, >> >> Kevin C. Reed >> New Python User >

<    1   2   3   4   5   6   7   8   9   10   >