Re: Python 3 encoding question: Read a filename from stdin, subsequently open that filename

2010-11-30 Thread Albert Hopkins
On Tue, 2010-11-30 at 11:52 +0100, Peter Otten wrote: Dan Stromberg wrote: > > > I've got a couple of programs that read filenames from stdin, and then > > open those files and do things with them. These programs sort of do > > the *ix xargs thing, without requiring xargs. > > > > In Python 2, t

Re: Python 3 encoding question: Read a filename from stdin, subsequently open that filename

2010-11-30 Thread Albert Hopkins
On Wed, 2010-12-01 at 02:14 +, MRAB wrote: > If the filenames are to be shown to a user then there needs to be a > mapping between bytes and glyphs. That's an encoding. If different > users use different encodings then exchange of textual data becomes > difficult. That's presentation, that's s

Re: pythonrag

2010-04-05 Thread Albert Hopkins
On Mon, 2010-04-05 at 11:38 +, Jason Friedman wrote: > I saw this posted in the July issue but did not see any follow-up there: > > $ python > Python 2.6.4 (r264:75706, Dec 7 2009, 18:43:55) > [GCC 4.4.1] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>

Re: Django as exemplary design

2010-05-06 Thread Albert Hopkins
On Thu, 2010-05-06 at 16:38 -0700, Patrick Maupin wrote: > I don't know how this applies to reading other peoples' code, but > recent research shows we learn more from success than failure That's good to learn, because for years I have been intentionally failing in order to learn from it and beco

walk directory & ignore all files/directories begin with '.'

2010-05-13 Thread albert kao
I want to walk a directory and ignore all the files or directories which names begin in '.' (e.g. '.svn'). Then I will process all the files. My test program walknodot.py does not do the job yet. Python version is 3.1 on windows XP. Please help. [code] #!c:/Python31/python.exe -u import os import

Re: walk directory & ignore all files/directories begin with '.'

2010-05-13 Thread albert kao
On May 13, 3:10 pm, MRAB wrote: > albert kao wrote: > > I want to walk a directory and ignore all the files or directories > > which names begin in '.' (e.g. '.svn'). > > Then I will process all the files. > > My test program walknodot.py does n

use only files but ignore directories on Windows

2010-05-13 Thread albert kao
My program plan to use only files but ignore directories on Windows. I google but do not find some functions like bool isFile(string) bool isDirectory(string) Please help. -- http://mail.python.org/mailman/listinfo/python-list

recursively remove all the directories and files which begin with '.'

2010-05-14 Thread albert kao
How do I recursively remove all the directories and files which begin with '.'? My test program rmdir.py does not do the job yet. Please help. [code] #!c:/Python31/python.exe -u import os from shutil import * root = "C:\\test\\com.comp.hw.prod.proj.war\\bin" for curdir, dirs, files in os.walk(roo

Re: recursively remove all the directories and files which begin with '.'

2010-05-14 Thread albert kao
On May 14, 11:01 am, J wrote: > On Fri, May 14, 2010 at 10:53, albert kao wrote: > > > C:\python>rmdir.py > > C:\test\com.comp.hw.prod.proj.war\bin > > ['.svn', 'com'] > > d .svn > > dotd C:\test\com.comp.hw.prod.proj.war\bin\.svn

Re: max time wait for a function

2010-05-18 Thread Albert Hopkins
On Tue, 2010-05-18 at 02:45 -0700, pacopyc wrote: > Hi, I've a question for you. I'd like to call a function and waiting > its return value for a time max (30 sec). > The function could not respond and then I must avoid to wait for > infinite time. OS is Windows XP. > Can you help me? > > Thank T

Re: Challenging Job Opportunity for a C# Architect/ Developer

2010-06-01 Thread Albert Hopkins
On Tue, 2010-06-01 at 19:44 -0700, rzzzwilson wrote: > http://www.catb.org/~esr/faqs/smart-questions.html#forum werd. -- http://mail.python.org/mailman/listinfo/python-list

Re: Import fails (newbie)

2010-06-17 Thread Albert Hopkins
On Thu, 2010-06-17 at 12:04 -0700, mhorlick wrote: > Hello, > > I'm a newbie and I have a small problem. After invoking IDLE --> > > Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit > (Intel)] on win32 > Type "copyright", "credits" or "license()" for more information. > >>> imp

Re: I strongly dislike Python 3

2010-06-26 Thread Albert Hopkins
Python 3 is, by design, not 100% backwards compatible with Python 2. Not that I'm completely happy with everything in Python 3 but, in it's defense, discussion of Python 3 has been ongoing for years, almost as long as the existence of Python 2. So the discussion of what went into Python 3 is so o

Re: Scan until random delimiter.

2010-06-27 Thread Albert Hopkins
On Sun, 2010-06-27 at 22:41 +0200, Laurent Verweijen wrote: > In contrast to java or c python seems not be able to use a random > delimiter. > > In java, you can do: > > > Code: > > import java.util.Scanner > > Scanner sc = new Scanner(System.in).useSeperator(" ") > int a = sc.nextInt() > >

PDF Generation With Reportlab

2010-06-28 Thread Albert Leibbrandt
y.append(t) doc.build(Story, onFirstPage=myFirstPage, onLaterPages=myLaterPages) myFirstPage and MyLaterPages are functions that use the canvas to draw the page header and footer. Any advice would be greatly appreciated. Cheers Albert -- http://mail.python.org/mailman/listinfo/python-list

Re: PDF Generation With Reportlab

2010-06-30 Thread Albert Leibbrandt
On 2010/06/30 10:52 AM, Tim Roberts wrote: Albert Leibbrandt wrote: I am hoping there is someone out there that knows reportlab quite well. I posted this on the reportlab mailing list but there is not much activity on that list Never the less, that is the correct forum for this

Re: Python 2.4.2 Installation error

2010-07-01 Thread Albert Hopkins
On Thu, 2010-07-01 at 21:51 +0530, Dhilip S wrote: > Hello Everyone.. > > I'm using Ubuntu 10.04, i try to install Python 2.4.2 & Python 2.4.3 > got error message while doing make command. anybody can tell tell, How > to overcome this error "this" error apparently did not get included in you

Re: Possible to include \n chars in doctest code samples or output?

2010-07-16 Thread Albert Hopkins
On Fri, 2010-07-16 at 01:26 -0400, pyt...@bdurham.com wrote: > I understand what you're saying, but I'm struggling with how to > represent the following strings in doctest code and doctest results. > No > matter what combination of backslashes or raw strings I use, I am > unable > to find a way to

Re: measuring a function time

2010-07-30 Thread Albert Hopkins
On Fri, 2010-07-30 at 14:28 +0200, Hrvoje Niksic wrote: > Steven D'Aprano writes: > > > On Thu, 29 Jul 2010 14:42:58 +0200, Matteo Landi wrote: > > > >> This should be enough > >> > >import time > >tic = time.time() > >function() > >toc = time.time() > >print toc - tic > > >

Re: Why is python not written in C++ ?

2010-08-01 Thread Albert Hopkins
On Mon, 2010-08-02 at 01:08 +0200, candide wrote: > Python is an object oriented langage (OOL). The Python main > implementation is written in pure and "old" C90. Is it for historical > reasons? > > C is not an OOL and C++ strongly is. I wonder if it wouldn't be more > suitable to implement an

Re: Python Script Cannot Write to Directory

2010-08-03 Thread Albert Hopkins
On Tue, 2010-08-03 at 21:01 -0700, Chris Brauchli wrote: > Hi, > > I am writing a script that, at one point, copies a file from directory > A to directory B. Directory B can only be written to by root, but the > script is always called with sudo, so this shouldn't be an issue, but > it is. I have

Re: subprocess.Popen calling httpd reload never finishes

2010-08-17 Thread Albert Hopkins
On Tue, 2010-08-17 at 12:55 -0700, Nan wrote: > Hi folks -- > > I have a Python script running under Apache/mod_wsgi that needs to > reload Apache configs as part of its operation. The script continues > to execute after the subprocess.Popen call. The communicate() method > returns the correct t

Re: subprocess.Popen calling httpd reload never finishes

2010-08-18 Thread Albert Hopkins
On Wed, 2010-08-18 at 06:58 -0700, Nan wrote: > Ah, I'd been told that there would be no conflict, and that this was > just reloading the configuration, not restarting Apache. > > I do need the web app to instruct Apache to reload because just before > this it's creating new VirtualHosts that need

Re: trying to understand dictionaries

2009-06-12 Thread Albert Hopkins
On Fri, 2009-06-12 at 04:51 -0700, khem...@gmail.com wrote: > Hi. > As the subject says, I'm a newbie trying to learn python and now > dictionaries. I can create a dict, understand it and use it for simple > tasks. But the thing is that I don't really get the point on how to > use these in real lif

Re: postgreSQL python bindings - which one?

2009-06-27 Thread Albert Hopkins
On Fri, 2009-06-26 at 21:10 -0700, Horace Blegg wrote: > Hi, I'm having a hard time deciding which set of PGSQL python bindings > to go with. I don't know much about SQL to begin with, so the collage > of packages of somewhat daunting. I'm starting a pet project in order > to teach my self more, bu

Re: Propagate import for all modules in a package.

2009-07-17 Thread Albert Hopkins
On Fri, 2009-07-17 at 10:28 -0700, Phil wrote: > I'm really new to Python and I am absolutely stumped trying to figure > this out. I have searched plenty, but I am either searching for the > wrong keywords or this isn't possible. > > What I want to do is have one import be global for the entire pa

Re: Beginners question

2009-07-17 Thread Albert Hopkins
On Fri, 2009-07-17 at 21:42 -0400, Ronn Ross wrote: > How do you define a global variable in a class. I bit of a mix-up with words here. A variable can be a class variable or a global variable (wrt the module).. not both. > I tried this with do success: > class ClassName: > global_var = 1 >

Re: How to import pydoc and then use it?

2009-07-20 Thread Albert Hopkins
On Mon, 2009-07-20 at 13:38 -0700, mrstevegross wrote: > I know how to use pydoc from the command line. However, because of > complicated environmental setup, it would be preferable to run it > within a python script as a native API call. That is, my python runner > looks a bit like this: > > im

Re: Python quirk in evaluation order

2009-07-31 Thread Albert Hopkins
On Fri, 2009-07-31 at 13:11 -0700, James Stroud wrote: > Python 2.5: > > mbi136-176 211% python > *** Pasting of code with ">>>" or "..." has been enabled. > > ## ipython

Re: kw param question

2009-08-03 Thread Albert Hopkins
On Mon, 2009-08-03 at 19:59 +, kj wrote: > > I want to write a decorator that, among other things, returns a > function that has one additional keyword parameter, say foo=None. > > When I try > > def my_decorator(f): > # blah, blah > def wrapper(*p, foo=None, **kw): > x = f(*

Re: error return from urlopen

2009-08-05 Thread Albert Hopkins
On Wed, 2009-08-05 at 20:48 +0530, Rustom Mody wrote: > When I direct urlopen to a non-existent server process I get > > IOError: [Errno socket error] (10061, 'Connection refused') > The connection refused is as expected but whats the 10061? > strerror(10061) says 'unknown error' > > So its like

Re: Character encoding & the copyright symbol

2009-08-06 Thread Albert Hopkins
On Thu, 2009-08-06 at 09:14 -0700, Robert Dailey wrote: > Hello, > > I'm loading a file via open() in Python 3.1 and I'm getting the > following error when I try to print the contents of the file that I > obtained through a call to read(): > > UnicodeEncodeError: 'charmap' codec can't encode char

Re: PEP 8 exegetics: conditional imports?

2009-08-07 Thread Albert Hopkins
On Fri, 2009-08-07 at 16:50 +, kj wrote: > > Conditional imports make sense to me, as in the following example: > > def foobar(filename): > if os.path.splitext(filename)[1] == '.gz': > import gzip > f = gzip.open(filename) > else: > f = file(filename) > # e

Re: PEP 8 exegetics: conditional imports?

2009-08-07 Thread Albert Hopkins
On Fri, 2009-08-07 at 16:50 +, kj wrote: > > Conditional imports make sense to me, as in the following example: > > def foobar(filename): > if os.path.splitext(filename)[1] == '.gz': > import gzip > f = gzip.open(filename) > else: > f = file(filename) > # e

Re: loops for ffmpeg CLI in python

2009-08-13 Thread Albert Hopkins
On Wed, 2009-08-12 at 11:29 +0200, fakhar Gillani wrote: > > Hi, > > I am a begineer in Python. Actually I am encoding video files with > different bitrates using ffmpeg CLI. I wanted to ask you that how can > I make loops so that I can vary the bitrates in the CLI of ffmpeg?? > > I want to b

Re: get output of du / ls command - currently ugly code ...

2009-08-13 Thread Albert Hopkins
On Thu, 2009-08-13 at 15:28 -0400, Esmail wrote: > Hi all, > > Essentially all I want to know the size of a directory, and the size > of a zipped tarball so that I can compute/report the compression ratio. > > The code I have seems hideous, but it seems to work. Surely there is an > easier,more e

Re: anyone with genomewide microarray analysis experience ?

2009-08-15 Thread Istvan Albert
On Aug 14, 8:52 am, trias wrote: > Does anyone have some scripts I could use for this purpose. I work with > S.cerevisiae Since the largest chromosome on the yeast genome is around 4 million bp, the easiest way to accomplish your goal is to create a list of the same size as the chromosome, then

Re: Strongly typed list

2009-08-18 Thread Albert Hopkins
On Tue, 2009-08-18 at 08:46 +0200, Diez B. Roggisch wrote: <هاني الموصلي schrieb: > > Please could you lead me to a way or a good IDE that makes developing > > huge projects in python more easier than what i found.Now i am using > > eclips. Actually it is very hard to remember all my classes metho

Re: Raw Strings with Variables

2009-08-18 Thread Albert Hopkins
On Tue, 2009-08-18 at 16:16 -0700, WilsonOfCanada wrote: > Hellos, > > I know that if you have: > > happy = r"C:\moo" > print happy > > you get C:\moo instead of C:\\moo > > The thing is that I want to do this a variable instead. > > ex. testline = fileName.readline() > rawtestline = r t

Re: Reading, writing files

2009-08-21 Thread Albert Hopkins
On Fri, 2009-08-21 at 15:21 -0700, seanm wrote: > In the book I am using, they give the following function as an > example: > > def copyFile(oldFile, newFile): > f1 = open(oldFile, 'r') > f2 = open(newFile, 'w') > while True: > text = f1.read(50) > if text == "": >

Re: Help Please

2009-08-21 Thread Albert Hopkins
Why do you post the same question twice within 5 minutes of each other? -- http://mail.python.org/mailman/listinfo/python-list

Re: debugger

2009-08-22 Thread Albert Hopkins
On Sat, 2009-08-22 at 01:17 -0700, flagmino wrote: [...] > I am trying to debug: > I press shift-F9 and F7. I end up in the interpreter where I enter s2 > (1, 2). > > >From that point if I press F7, the program restart all over. > If I press Enter, the program gets out of debug mode. Umm.. which

Re: Decompressing gzip over FTP

2009-08-22 Thread Albert Hopkins
On Fri, 2009-08-21 at 18:15 -0700, SeanMon wrote: > Is there a way to decompress a large (2GB) gzipped file being > retrieved over FTP on the fly? > > I'm using ftplib.FTP to open a connection to a remote server, and I > have had no success connecting retrbinary to gzip without using an > intermed

Re: Combining python and perl

2009-08-23 Thread Albert Hopkins
On Sun, 2009-08-23 at 05:37 -0700, Peng Yu wrote: > Hi, > > According to http://www.python.org/doc/essays/comparisons.html, it > says > > "Python and Perl come from a similar background (Unix scripting, which > both have long outgrown), and sport many similar features, but have a > different phil

Re: Trying To Catch Invalid User Input

2009-08-23 Thread Albert Hopkins
On Sun, 2009-08-23 at 16:36 +0100, MRAB wrote: > Victor Subervi wrote: > > Hi; > > I have the following: > > > > style = raw_input('What style is this? (1 = short, 2 = long): ') > > flag = 0 > > while flag == 0: > > if (style != 1) or (style != 2): > > style = raw_input('There was a mistake.

Re: web frameworks that support Python 3

2009-08-23 Thread Albert Hopkins
On Sun, 2009-08-23 at 13:13 -0700, David Prager Branner wrote: > I use Chinese and therefore Unicode very heavily, and so Python 3 is > an unavoidable choice for me. But I'm frustrated by the fact that > Django, Pylons, and TurboGears do not support Python 3 yet and > (according to their developmen

Re: Combining python and perl

2009-08-23 Thread Albert Hopkins
On Sun, 2009-08-23 at 12:54 -0700, Peng Yu wrote: > I understand that the sames things can be done with both language. > > But I do think that certain applications can be done faster (in term > of the coding & debugging time, I don't care runtime here) with one > language than with another. Yes

Re: Reading binary files

2009-08-24 Thread Albert Hopkins
On Mon, 2009-08-24 at 10:35 -0400, Ronn Ross wrote: > I need to read a binary file. When I open it up in a text editor it is > just junk. Does Python have a class to help with this? Yes, the "file" class. >>> myfile = open('/path/to/binary/file', 'rb') -a -- http://mail.python.org/mailman/li

Re: Graph library recommendations for large graphs

2009-08-24 Thread Istvan Albert
On Aug 24, 5:37 pm, VanL wrote: > > Can anybody who has worked with large graphs before give a recommendation? > when using large graphs another limitation may come from the various graph algorithm run times. Most likely you will need to squeeze out as much as possible and a python implementation

Re: (Simple?) Unicode Question

2009-08-27 Thread Albert Hopkins
On Thu, 2009-08-27 at 22:09 +0530, Shashank Singh wrote: > Hi All! > > I have a very simple (and probably stupid) question eluding me. > When exactly is the char-set information needed? > > To make my question clear consider reading a file. > While reading a file, all I get is basically an array

Re: [OT] How do I reply to a thread by sending a message to python-list@python.org

2009-08-28 Thread Albert Hopkins
On Fri, 2009-08-28 at 19:04 +1000, Xavier Ho wrote: > On Fri, Aug 28, 2009 at 6:54 PM, Ben Finney +pyt...@benfinney.id.au> wrote: > Fortunately, the messages that come from the list enable any > mail client > to know the correct address for “reply to list”. It only >

Re: Is behavior of += intentional for int?

2009-08-30 Thread Albert Hopkins
On Sun, 2009-08-30 at 10:44 +, Steven D'Aprano wrote: > It also follows from the idea that there is one abstract entity which > English speakers call "three" and write as 3. There's not two > identical > entities with value 3, or four, or a million of them, only one. That's not true. There

Re: Is behavior of += intentional for int?

2009-08-30 Thread Albert Hopkins
On Sun, 2009-08-30 at 04:49 -0700, Carl Banks wrote: > It's pretty common for people coming from "name is a location in > memory" languages to have this conception of integers as an > intermediate stage of learning Python's object system. Even once > they've understood "everything is an object" an

Re: Python for 64bit Linux version

2009-09-03 Thread Albert Hopkins
On Thu, 2009-09-03 at 13:30 -0500, Bhanu Srinivas Mangipudi wrote: > > I just want to that s there a 64 bit Linux version for python ? if yes > can you provide me any links for it.I could find a 64bit windows > version but could not find Linuux version If you are using a 64bit Linux distribution

Re: issue with grep command

2009-09-03 Thread Albert Hopkins
On Thu, 2009-09-03 at 11:51 -0700, Jul wrote: [Stuff about tcsh and grep deleted] What on earth does this have to do with Python? -a -- http://mail.python.org/mailman/listinfo/python-list

Re: Try Except Problem

2009-09-03 Thread Albert Hopkins
On Tue, 2009-09-01 at 13:45 -0500, Victor Subervi wrote: > Hi: I have this code: [blah] It's hard to tell because: 1. You posted code in HTML format, which is really hard to read 2. Even when viewed as plain text, you use non-standard indentation which is really hard to read

Re: Usage of main()

2009-09-04 Thread Albert Hopkins
On Fri, 2009-09-04 at 22:55 +1000, Ben Finney wrote: > * having a module that can be imported without side effects helps > select > pieces of the module's functionality > > * any module should be importable without side effects to make it > easier > to run unit tests for that module > +1 --

Re: wxGlade question - How to add new event to a button in events tab?

2009-09-08 Thread Albert Hopkins
Could you not post the exact same message 3 times within an hour? -- http://mail.python.org/mailman/listinfo/python-list

Re: start default application for read a pdf from python

2009-09-08 Thread Albert Hopkins
On Tue, 2009-09-08 at 22:22 +0200, Angelo Ballabio wrote: > My problem is a way to run a default application to read and show a > pdf > file from unix or windows, i have a mixed ambient in the office, so I > am > try to find a way to start a application to show this pdf file I > generate whith r

Re: AttributeError: 'module' object has no attribute 'pack'

2009-09-10 Thread Albert Hopkins
On Thu, 2009-09-10 at 21:07 +0300, Sampsa Riikonen wrote: > Dear List, > > I have a freshly installed opensuse 11.2 and I am experiencing the following > problem with the module "subprocess": > > sam...@linux-912g:~> python > Python 2.6 (r26:66714, Feb 3 2009, 20:52:03) > [GCC 4.3.2 [gcc-4_3-bra

Re: How can I use my modules here?

2009-09-11 Thread Albert Hopkins
On Fri, 2009-09-11 at 02:29 -0700, Chris Rebert wrote: > For some reason, your Python program is being executed by bash as if > it were a shell script, which it's not. > No idea what the cause is though. Because the first 2 bytes of the file need to be #!/path/to/interpreter, the OP has:

Re: How to define a function with an empty body?

2009-09-13 Thread Albert Hopkins
On Sat, 2009-09-12 at 22:37 -0500, Peng Yu wrote: > Hi, > > I want to define a function without anything in it body. In C++, I can > do something like the following because I can use "{}" to denote an > empty function body. Since python use indentation, I am not sure how > to do it. Can somebody l

Re: Is there a similar mailing list about django?

2009-09-13 Thread Albert Hopkins
On Sun, 2009-09-13 at 21:27 +0200, Andreas Waldenburger wrote: > Didn't like http://groups-beta.google.com/group/django-users ? > > (Second hit for "django mailing list", but I know Google results vary > from country to country, so you might not have seen it.) Or, better yet, go to Django's web s

Re: Is there a similar mailing list about django?

2009-09-13 Thread Albert Hopkins
On Sun, 2009-09-13 at 18:46 -0400, Joel Goldstick wrote: > Thanks.. I saw the google group, but I was hoping for a list that I > can > read in my thunderbird client. Thanks all for the good pointers And if you simply go to the Django web site and click on "Community" there is a form where you ca

Re: triangle python user's group?

2010-08-30 Thread Albert Hopkins
On Mon, 2010-08-30 at 12:38 -0700, Tim Arnold wrote: > Hi, > Is there a python users group in the Research Triangle Park area > (North Carolina, USA)? Google "triangle python user's group" -- http://mail.python.org/mailman/listinfo/python-list

Re: Saving (unusual) linux filenames

2010-08-31 Thread Albert Hopkins
On Tue, 2010-08-31 at 16:49 +0200, amfr...@web.de wrote: > i have a script that reads and writes linux paths in a file. I save > the > path (as unicode) with 2 other variables. I save them seperated by "," > and > the "packets" by newlines. So my file looks like this: > path1, var1A, var1B > pa

Re: Python [repair_cycorder_mov.py]

2010-09-05 Thread Albert Hopkins
On Sun, 2010-09-05 at 14:00 +, Steven D'Aprano wrote: > By the way, there's no need to send three messages in 10 minutes > asking > the same question, and adding FORM METHOD links to your post will > probably just get it flagged as spam by many people. Apparently it has, as I only got this

Re: Minimum and Maximum of a list containing floating point numbers

2010-09-06 Thread Albert Hopkins
On Mon, 2010-09-06 at 17:37 -0700, ceycey wrote: > I have a list like ['1.1881', '1.1881', '1.1881', '1.1881', '1.1881', > '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.7689', '1.7689', > '3.4225', '7.7284', '10.24', '9.0601', '9.0601', '9.0601', '9.0601', > '9.0601']. What I want to do is

Re: The Samurai Principle

2010-09-07 Thread Albert Hopkins
On Mon, 2010-09-06 at 20:48 -0700, Phlip wrote: > Pythonistas: > > The "Samurai Principle" says to return victorious, or not at all. This > is why django.db wisely throws an exception, instead of simply > returning None, if it encounters a "record not found". How does that compare to, say, the "K

Re: SendKeys and Python 2.7

2010-09-09 Thread Albert Hopkins
On Thu, 2010-09-09 at 07:07 -0300, Jakson A. Aquino wrote: > Vim needs python 2.7 >From where do you base this assertion? I have been using vim 7.3 (with embedded python) with python 2.6 pretty much since it has been released. :version VIM - Vi IMproved 7.3 (2010 Aug 15, compiled

Re: Printing the name of a variable

2010-09-09 Thread Albert Hopkins
On Thu, 2010-09-09 at 12:43 -0700, Stephen Boulet wrote: > Does an arbitrary variable carry an attribute describing the text in > its name? I'm looking for something along the lines of: > > x = 10 > print x.name > >>> 'x' > > Perhaps the x.__getattribute__ method? Thanks. Variables are not objec

Re: How to find free resident memory in Linux using python

2010-10-02 Thread Albert Hopkins
On Sat, 2010-10-02 at 07:06 -0700, Sandy wrote: > Hi all, > I want to find how much free memory (RAM) is available in my system > using python. I tried psutil, parsing /proc/meminfo, top output etc > but not satisfied. For example my gnome-system-monitor gui shows I am > using 1GB (25%) of my RAM w

Re: Boolean value of generators

2010-10-14 Thread Albert Hopkins
On Thu, 2010-10-14 at 10:16 +0100, Tony wrote: > I have been using generators for the first time and wanted to check for > an empty result. Naively I assumed that generators would give > appopriate boolean values. For example > > def xx(): > l = [] > for x in l: > yield x > > y = xx() >

Re: Boolean value of generators

2010-10-15 Thread Albert Hopkins
On Fri, 2010-10-15 at 14:54 +, Grant Edwards wrote: > > so you could test for emptiness, look ahead at the next item without > > consuming it, etc. > > And what happens when the generator is doing things like executing > database transactions? You should also add prediction to the caching.

Re: Fastest way to detect a non-ASCII character in a list of strings.

2010-10-17 Thread Albert Hopkins
On Sun, 2010-10-17 at 14:59 -0500, Dun Peal wrote: > `all_ascii(L)` is a function that accepts a list of strings L, and > returns True if all of those strings contain only ASCII chars, False > otherwise. > > What's the fastest way to implement `all_ascii(L)`? > > My ideas so far are: > > 1. Matc

Re: PyCharm

2010-10-19 Thread Albert Hopkins
On Tue, 2010-10-19 at 10:05 -0700, CoffeeKid wrote: > Your video is childish When you have someone called "Kid" calling you childish... that's pretty low. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why "flat is better than nested"?

2010-10-26 Thread Albert Hopkins
On Tue, 2010-10-26 at 09:45 -0700, John Nagle wrote: > On 10/25/2010 6:34 AM, Alex Willmer wrote: > > On Oct 25, 11:07 am, kj wrote: > >> In "The Zen of Python", one of the "maxims" is "flat is better than > >> nested"? Why? Can anyone give me a concrete example that illustrates > >> this point?

Re: [pyxl] xlrd-0.8.0 .xlsx formatting_info=True not implemented

2012-08-31 Thread Albert-Jan Roskam
time http://cran.r-project.org/web/packages/xlsx/xlsx.pdf   Regards, Albert-Jan ~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health,

Re: Fabric Engine + Python benchmarks

2012-02-10 Thread Albert W. Hopkins
On Fri, 2012-02-10 at 14:52 -0800, Paul Rubin wrote: > Fabric Paul writes: > > Hi Stefan - Thanks for the heads up. Fabric Engine has been going for > > about 2 years now. Registered company etc. I'll be sure to refer to it > > as Fabric Engine so there's no confusion. We were unaware there was a

Re: MySQL: AttributeError: cursor

2012-02-11 Thread Albert W. Hopkins
On Sat, 2012-02-11 at 09:40 -0800, Kevin Murphy wrote: > Hi All, > I'm using Python 2.7 and having a problem creating the cursor below. > Any suggestions would be appreciated! > > import sys > import _mysql > > print "cursor test" > > db = > _mysql.connect(host="localhost",user="root",passwd="my

Re: "convert" string to bytes without changing data (encoding)

2012-03-28 Thread Albert W. Hopkins
On Wed, 2012-03-28 at 14:05 -0400, Ross Ridge wrote: > Ross Ridge wr= > > Of course it is. =A0Conceptually you're not supposed to think of it that > > way, but a string is stored in memory as a series of bytes. > > Chris Angelico wrote: > >Note that distinction. I said that a string "is not" a

Re: Question on Python 3 shell restarting

2012-04-09 Thread Albert W. Hopkins
On Sun, 2012-04-08 at 20:09 +0200, Franck Ditter wrote: > How may I get a fresh Python shell with Idle 3.2 ? > I have to run the same modules several times with all > variables cleared. Why don't you write your module as a script and pass the variables via command line like most human beings? --

Re: Stop quoting spam [was Re: Hot Girls ...]

2011-08-19 Thread Albert W. Hopkins
On Friday, August 19 at 17:12 (-0400), Matty Sarro said: > > If you're that offended then spend the cycles fixing the damn list so > it > stops having so much spam. You realize spam comes in almost > constantly, > right? Enough that multiple tines over the past weeks there have been > no > less

Book recommendation for Spark/Pyspark?

2017-11-13 Thread Albert-Jan Roskam
its cover. Thanks! Albert-Jan -- https://mail.python.org/mailman/listinfo/python-list

Re: Numpy and Terabyte data

2018-01-03 Thread Albert-Jan Roskam
On Jan 2, 2018 18:27, Rustom Mody wrote: > > Someone who works in hadoop asked me: > > If our data is in terabytes can we do statistical (ie numpy pandas etc) > analysis on it? > > I said: No (I dont think so at least!) ie I expect numpy (pandas etc) > to not work if the data does not fit in memo

Re: Tuple unpacking inside lambda expressions

2022-04-20 Thread Albert-Jan Roskam
On Apr 20, 2022 13:01, Sam Ezeh wrote: I went back to the code recently and I remembered what the problem was. I was using multiprocessing.Pool.pmap which takes a callable (the lambda here) so I wasn't able to use comprehensions or starmap Is there anything for situations

Register multiple excepthooks?

2022-07-31 Thread Albert-Jan Roskam
log_uncaught_errors() so it does both things? Thanks! Albert-Jan -- https://mail.python.org/mailman/listinfo/python-list

Re: Register multiple excepthooks?

2022-08-04 Thread Albert-Jan Roskam
On Aug 1, 2022 19:34, Dieter Maurer wrote: Albert-Jan Roskam wrote at 2022-7-31 11:39 +0200: >   I have a function init_logging.log_uncaught_errors() that I use for >   sys.excepthook. Now I also want to call another function (ffi.dlclose()) >   upon

Book/resource recommendation about Celery?

2022-09-15 Thread Albert-Jan Roskam
Hi, I'm using Flask + Celery + RabbitMQ. Can anyone recommend a good book or other resource about Celery?  Thanks! Albert-Jan -- https://mail.python.org/mailman/listinfo/python-list

Re: Find the path of a shell command

2022-10-14 Thread Albert-Jan Roskam
On Oct 14, 2022 18:19, "Peter J. Holzer" wrote: On 2022-10-14 07:40:14 -0700, Dan Stromberg wrote: > Alternatively, you can "ps axfwwe" (on Linux) to see environment > variables, and check what the environment of cron (or similar) is.  It > is this environment (mostly) that

Yaml.unsafe_load error

2022-10-19 Thread Albert-Jan Roskam
code below. Thanks! Albert-Jan Python 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import yaml >>> f

Re: Yaml.unsafe_load error

2022-10-19 Thread Albert-Jan Roskam
On Oct 19, 2022 13:02, Albert-Jan Roskam wrote:    Hi,    I am trying to create a celery.schedules.crontab object from an external    yaml file. I can successfully create an instance from a dummy class "Bar",    but the crontab class seems call __setsta

Re: Keeping a list of records with named fields that can be updated

2022-12-17 Thread Albert-Jan Roskam
On Dec 15, 2022 10:21, Peter Otten <__pete...@web.de> wrote: >>> from collections import namedtuple >>> Row = namedtuple("Row", "foo bar baz") >>> row = Row(1, 2, 3) >>> row._replace(bar=42) Row(foo=1, bar=42, baz=3) Ahh, I always thought these are undocumen

Re: How to enter escape character in a positional string argument from the command line?

2022-12-21 Thread Albert-Jan Roskam
On Dec 21, 2022 06:01, Chris Angelico wrote: On Wed, 21 Dec 2022 at 15:28, Jach Feng wrote: > That's what I am taking this path under Windows now, the ultimate solution before Windows has shell similar to bash:-) Technically, Windows DOES have a shell similar to bash. It'

Re: Fast lookup of bulky "table"

2023-01-16 Thread Albert-Jan Roskam
On Jan 15, 2023 05:26, Dino wrote: Hello, I have built a PoC service in Python Flask for my work, and - now that the point is made - I need to make it a little more performant (to be honest, chances are that someone else will pick up from where I left off, and implement the

Re: LRU cache

2023-02-18 Thread Albert-Jan Roskam
:         _cache.pop()     try:         return _cache[arg]     except KeyError:         result = expensivefunc(arg)         _cache[arg] = result         return result Albert-Jan -- https://mail.python.org/mailman/listinfo/python-list

Re: LRU cache

2023-02-18 Thread Albert-Jan Roskam
On Feb 18, 2023 17:28, Rob Cliffe via Python-list wrote: On 18/02/2023 15:29, Thomas Passin wrote: > On 2/18/2023 5:38 AM, Albert-Jan Roskam wrote: >>     I sometimes use this trick, which I learnt from a book by Martelli. >>     Instead of try/exc

Re: Packaging/MANIFEST.in: Incude All, Exclude .gitignore

2021-03-13 Thread Albert-Jan Roskam
you could call a simple bash script in a git hook that syncs your MANIFEST.in with your .gitignore. Something like: echo -n "exclude " > MANIFEST.in cat .gitignore | tr '\n' ' ' >> MANIFEST.in echo "graft $(readlink -f ./keep/this)" >> MANIFEST.in https://docs.python.org/2/distuti

Re: .title() - annoying mistake

2021-03-21 Thread Albert-Jan Roskam
On 20 Mar 2021 23:47, Cameron Simpson wrote: On 20Mar2021 12:53, Sibylle Koczian wrote: >Am 20.03.2021 um 09:34 schrieb Alan Bawden: >>The real reason Python strings support a .title() method is surely >>because Unicode supports upper, lower, _and_ title case letters, and

Async requests library with NTLM auth support?

2021-06-01 Thread Albert-Jan Roskam
Hi, I need to make thousands of requests that require ntlm authentication so I was hoping to do them asynchronously. With synchronous requests I use requests/requests_ntlm. Asyncio and httpx [1] look promising but don't seem to support ntlm. Any tips? Cheers! Albert-Jan

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