Re: What way is the best to check an empty list?

2009-03-25 Thread Albert Hopkins
On Wed, 2009-03-25 at 21:26 +, Martin P. Hellwig wrote: > > > > PEP 8 recommends the latter. > > > > > > Raymond > I can't seem to find where this recommendation is mentioned or implied. Wow, you must not have looked very hard: 1. Point your browser to http://www.python.org/dev/peps/p

Re: Odd behavior regarding a list

2009-03-26 Thread Albert Hopkins
On Thu, 2009-03-26 at 08:36 -0700, Edd Barrett wrote: > Hi there, > > My first post here, so hello :) > > Just a little background, I am writing my dissertation, which is a JIT > compiler based upon LLVM and it's python bindings, along with the > aperiot LL(1) parser. > > I have some code here,

Re: Find duplicates in a list and count them ...

2009-03-26 Thread Albert Hopkins
On Thu, 2009-03-26 at 12:22 -0700, paul.scipi...@aps.com wrote: > Hello, > > I'm a newbie to Python. I have a list which contains integers (about > 80,000). I want to find a quick way to get the numbers that occur in > the list more than once, and how many times that number is duplicated > in t

Re: Find duplicates in a list and count them ...

2009-03-26 Thread Albert Hopkins
On Thu, 2009-03-26 at 15:54 -0400, Albert Hopkins wrote: [...] > $ cat test.py > from random import randint > > l = list() > for i in xrange(8): > l.append(randint(0,10)) ^^^ should have been: l.append(randint(0,9)) > > hi

Re: running shelscript inside python

2009-03-26 Thread Albert Hopkins
On Thu, 2009-03-26 at 15:23 -0700, harijay wrote: > Hi > I want to run shell scripts of the following kind from inside python > and for some reason either the os.system or the subprocess.call ways > are not working for me . > > I am calling a fortran command (f2mtz ) with some keyworded input that

Re: c.l.py dead, news at 11 (was Re: Mangle function name with decorator?)

2009-03-27 Thread Albert Hopkins
On Fri, 2009-03-27 at 10:47 -0700, Aahz wrote: > In article , > andrew cooke wrote: > >Aahz wrote: > >> > >> Excuse me? What decline of this newsgroup? > > > >Hmmm. It's hard to respond to this without implicitly criticising others > >here, which wasn't my point at all. But my personal impress

Re: pyqt drop to open a file

2009-03-27 Thread Albert Hopkins
On Fri, 2009-03-27 at 17:55 -0700, rui.li.s...@gmail.com wrote: > Hi, > > anyone can give a simple example or a link on how to use 'drop' with > pyqt. > > what I'm looking for is drop a file to main widget then program get > the path\filename > > something like: main_widget set to accept 'drop e

Re: c.l.py dead, news at 11 (was Re: Mangle function name with decorator?)

2009-03-27 Thread Albert Hopkins
On Fri, 2009-03-27 at 21:15 -0400, andrew cooke wrote: [...] > c.l.python used to be the core of a community built around a language. It > no longer is. It is a very useful place, where some very helpful and > knowledgeable people hang out and give advice, but instead of representing > the full

Re: Psycopg Documentation

2009-03-29 Thread Albert Hopkins
On Sun, 2009-03-29 at 11:35 +0100, taliesin wrote: > Hi, > > I'm probably being very dense so apologies in advance, but I can't find > any decent documentation for the psycopg module for PostgreSQL interfacing. > > Google and Yahoo don't seem to return much for any of the queries I gave > them an

Re: Did you noticed that Unipath is not more available?

2009-03-29 Thread Albert Hopkins
On Sun, 2009-03-29 at 15:17 +0200, Andrea Francia wrote: > Do you know/use Unipath? > Unipath is a OO path manipulation library. It's used, for example, to > rename, copy, deleting files. > > Unfortunately this library is no more available as I reported in [1]. > > I found a copy of the .egg in

Re: Problems with code

2009-03-30 Thread Albert Hopkins
On Mon, 2009-03-30 at 11:05 -0500, Zach Goscha wrote: > Hi, > > I am trying to call an unbound method (Map.Background) but getting the > following error: > TypeError: unbound method background() must be called with Map > instance as first argument (got nothing instead) > > Here is some of the

Re: imp.load_source() - explanation needed

2009-04-01 Thread Albert Hopkins
On Wed, 2009-04-01 at 12:17 -0700, mynthon wrote: > Hi! > > I need help. I don't understand what doc says. > > I load module from path testmod/mytest.py using imp.load_source(). My > code is > > import imp > testmod = imp.load_source('koko', 'testmod/mytest.py) > print testmod > > but i don't u

Re: statvfs clearance

2009-04-04 Thread Albert Hopkins
On Sat, 2009-04-04 at 03:56 -0700, Sreejith K wrote: > Python's statvfs module contains the following indexes to use with > os.statvfs() that contains the specified information > > statvfs.F_BSIZE > Preferred file system block size. > > statvfs.F_FRSIZE > Fundamental file system block siz

Re: statvfs clearance

2009-04-04 Thread Albert Hopkins
On Sat, 2009-04-04 at 15:48 +0200, Hrvoje Niksic wrote: > Sreejith K writes: > > > Python's statvfs module contains the following indexes to use with > > os.statvfs() that contains the specified information > > > > statvfs.F_BSIZE > > Preferred file system block size. > [...] > > statvfs.F_NA

Re: Issue with subprocess Module

2009-04-07 Thread Albert Hopkins
On Tue, 2009-04-07 at 07:53 -0400, Dave Angel wrote: > > > subprocess.Popen() is expecting the name of a program, which should > normally have an extension of .exe You're handing it a .bat file, > which is not executable. It only executes in the context of a command > interpreter (shell),

Re: Why does Python show the whole array?

2009-04-08 Thread Albert Hopkins
On Wed, 2009-04-08 at 12:01 +0200, Peter Otten wrote: > Gilles Ganault wrote: > > > I'd like to go through a list of e-mail addresses, and extract those > > that belong to well-known ISP's. For some reason I can't figure out, > > Python shows the whole list instead of just e-mails that match: > >

Re: Computed attribute names

2009-04-08 Thread Albert Hopkins
On Wed, 2009-04-08 at 19:47 +0100, Dale Amon wrote: > There are a number of things which I have been used > to doing in other OO languages which I have not yet > figured out how to do in Python, the most important > of which is passing method names as args and inserting > them into method calls. He

Re: Decompression with zlib

2009-04-08 Thread Albert Hopkins
On Wed, 2009-04-08 at 23:51 +0200, Emma Li wrote: > Hello, > > I'm trying to do compression/decompression of stuff with zlib, and I > just don't get it... > Here is an example. I assume that dec should be "a", but it isn't. dec > turns out to be an empty string, and I don't understand why... >

Re: any(), all() and empty iterable

2009-04-11 Thread Albert Hopkins
On Sun, 2009-04-12 at 04:00 +, John O'Hagan wrote: > Hi, > > I was getting some surprising false positives as a result of not expecting > this: > > all(element in item for item in iterable) > > to return True when 'iterable' is empty. > > I guess it goes into hairy Boolean territory tryin

Re: UnboundLocalError with extra code after return

2009-09-29 Thread Albert Hopkins
On Tue, 2009-09-29 at 21:15 -0700, Rich Healey wrote: > However: > > def callonce(func): > def nullmethod(): pass > def __(): > return func() > func = nullmethod > return ret > return __ > > @callonce > def t2(): > print "T2 called" > t2() > > Gives me: >

Re: Opinions, please, on PEP 8 and local, 3rd party imports

2009-10-02 Thread Albert Hopkins
On Fri, 2009-10-02 at 20:22 -0400, Simon Forman wrote: > 2.5 +1 I'd like to suggest 2.46 instead. -- http://mail.python.org/mailman/listinfo/python-list

Re: creating class objects inside methods

2009-10-04 Thread Albert Hopkins
Just by a brief look at your code snippet there are a few things that I would point out, stylistically, that you may consider changing in your code as they are generally not considered "pythonic": * As already mentioned the "state" class is best if given a name that is capitalized.

Re: Parsing email attachments: get_payload() produces unsaveable data

2009-10-04 Thread Albert Hopkins
On Sun, 2009-10-04 at 07:27 -0700, dpapathanasiou wrote: > When I try to write the filedata to a file system folder, though, I > get an AttributeError in the stack trace. And where might we be able to see that stack trace? -a -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing email attachments: get_payload() produces unsaveable data

2009-10-04 Thread Albert Hopkins
On Sun, 2009-10-04 at 08:16 -0700, dpapathanasiou wrote: > > And where might we be able to see that stack trace? > > This is it: > > Exception: ('AttributeError', '', [' File "/opt/server/smtp/ > smtps.py", line 213, in handle\ne > mail_replier.post_reply(recipient_mbox, \'\'.join(data))\n',

Re: Parsing email attachments: get_payload() produces unsaveable data

2009-10-04 Thread Albert Hopkins
On Sun, 2009-10-04 at 09:17 -0700, dpapathanasiou wrote: > > Which is *really* difficult (for me) to read. Any chance of providing a > > "normal" traceback? > > File "/opt/server/smtp/smtps.py", line 213, in handle > email_replier.post_reply(recipient_mbox, ''.join(data)) > File "/opt/ser

Re: Passing values from html to python

2009-10-22 Thread Albert Hopkins
On Thu, 2009-10-22 at 10:44 +0200, Ahmed Barakat wrote: > Hi guys, > > I am new to python and wed-development, I managed to have some nice > example running up till now. > I am playing with google app engine, I have this situation: > > I have a text box in an html page, I want to get the value in

Re: Web development with Python 3.1

2009-10-28 Thread Albert Hopkins
On Wed, 2009-10-28 at 15:32 +0200, Dotan Cohen wrote: > > def index(request): > >unmaintanable_html = """ > > > > > >Index > > > > > >Embedded HTML is a PITA > >but some like pains... > > > > > > """ > >return HttpResponse(unmaintanable_html) > > > > And if I need to

Re: Web development with Python 3.1

2009-10-28 Thread Albert Hopkins
On Wed, 2009-10-28 at 16:38 +0200, Dotan Cohen wrote: > > return HttpResponse(unmaintanable_html % data) > > > > That's fine for single variables, but if I need to output a table of > unknown rows? I assume that return means the end of the script. > Therefore I should shove the whole table into a

Re: popen function of os and subprocess modules

2009-10-28 Thread Albert Hopkins
On Wed, 2009-10-28 at 07:15 -0700, banu wrote: > > Thanks for the reply Jon > Basically I need to move into a folder and then need to execute some > shell commands(make etc.) in that folder. I just gave 'ls' for the > sake of an example. The real problem I am facing is, how to stay in > the folder

Re: Aaaargh! "global name 'eggz' is not defined"

2009-10-29 Thread Albert Hopkins
On Thu, 2009-10-29 at 17:27 -0500, Robert Kern wrote: > I consider "import *" the first error to be fixed, so it doesn't > bother me much. :-) But does pyflakes at least *warn* about the use of "import *" (I've never used it so just asking)? -- http://mail.python.org/mailman/listinfo/python-li

Re: OT: DARPA red balloon challenge

2009-10-30 Thread Albert Hopkins
On Thu, 2009-10-29 at 20:27 -0700, Adam N wrote: [...] > On December 5, DARPA will raise 10 red weather balloons somewhere in > the US. The first person to get the location of all 10 balloons and > submit them will be given $40k. Hasn't the U.S. had enough weather balloon-related publicity stunt

Re: Are *.pyd's universal?

2009-10-31 Thread Albert Hopkins
On Sat, 2009-10-31 at 21:32 +1300, Lawrence D'Oliveiro wrote: > Modules will sometimes find > > themselves on the path in Windows, so the fact that Windows performs > a > > library search on the path is quite significant. > > Why is it only Windows is prone to this problem? I think as someone po

Re: datetime question

2009-10-31 Thread Albert Hopkins
On Sat, 2009-10-31 at 10:08 +1100, Ben Finney wrote: > The ‘datetime’ module focusses on individual date+time values (and the > periods between them, with the ‘timedelta’ type). > > For querying the properties of the calendar, use the ‘calendar’ > module. > > Yes, it would be nice if the ‘time’,

Re: datetime question

2009-10-31 Thread Albert Hopkins
On Sat, 2009-10-31 at 20:34 +1100, Ben Finney wrote: > Fixing ‘time’, ‘datetime’, and ‘calendar’ was the reason for Python 3? > No, it wasn't. > > Or perhaps you mean that any backward-incompatible change was a reason > to have Python 3? Even more firmly no. The extent of changes was > severely li

Re: Python 2.6.4: ./configure does not work

2009-10-31 Thread Albert Hopkins
On Sat, 2009-10-31 at 03:07 -0700, knipknap wrote: > Hi, > > Running ./configure in the 2.6.4 sources produces the following error: > > config.status: error: cannot find input file: Makefile.pre.in > > Indeed, such a file is not contained anywhere in the Pakage. Which sources are you referring

Re: Are *.pyd's universal?

2009-10-31 Thread Albert Hopkins
On Sat, 2009-10-31 at 23:58 +1300, Lawrence D'Oliveiro wrote: > I just checked my Debian installation: > > l...@theon:~> find /lib /usr/lib -name \*.so -a -not -name lib\* > -print | wc -l > 2950 > l...@theon:~> find /lib /usr/lib -name \*.so -print | wc -l > 4708 > > So 63% of th

Re: import bug

2009-10-31 Thread Albert Hopkins
On Sat, 2009-10-31 at 16:27 +, kj wrote: > >2) this has been fixed in Py3 > > In my post I illustrated that the failure occurs both with Python > 2.6 *and* Python 3.0. Did you have a particular version of Python > 3 in mind? I was not able to reproduce with my python3: $ head ham/*

Re: Detecting new removable drives in Linux

2010-03-01 Thread Albert Hopkins
On Mon, 2010-03-01 at 10:48 +0100, Bart Smeets wrote: > Hello, > > > I'm trying to write a script which detects when a new removable drive > is connected to the computer. On #python I was advised to use the > dbus-bindings. However the documentation on this is limited. Does > anyone know of an ex

Re: pythonpath

2010-03-01 Thread Albert Hopkins
On Mon, 2010-03-01 at 02:48 -0800, luca72 wrote: > Sorry for my stupid question if i have to load module from a folder i > have to append it to the sys path the folder? > ex: > if my folder module is /home/lucak904/Scrivania/Luca/enigma2 > i do this : > import sys > sys.path.append('/home/lucak90

os.fdopen() issue in Python 3.1?

2010-03-02 Thread Albert Hopkins
I have a snippet of code that looks like this: pid, fd = os.forkpty() if pid == 0: subprocess.call(args) else: input = os.fdopen(fd).read() ... This seems to work find for CPython 2.5 and 2.6 on my Linux system. However, with CPython 3.1 I

Re: os.fdopen() issue in Python 3.1?

2010-03-02 Thread Albert Hopkins
On Tue, 2010-03-02 at 13:25 -0500, Terry Reedy wrote: > To get help, or report a bug, for something like this, be as specific as > possible. 'Linux' may be too generic. This is on Python on Gentoo Linux x64 with kernel 2.6.33. > > > However, with CPython 3.1 I get: > > > > input =

Re: os.fdopen() issue in Python 3.1?

2010-03-02 Thread Albert Hopkins
On Tue, 2010-03-02 at 17:32 +, MRAB wrote: > The documentation also mentions the 'pty' module. Have you tried that > instead? I haven't but I'll give it a try. Thanks. -a -- http://mail.python.org/mailman/listinfo/python-list

Re: os.fdopen() issue in Python 3.1?

2010-03-02 Thread Albert Hopkins
On Tue, 2010-03-02 at 17:32 +, MRAB wrote: > The documentation also mentions the 'pty' module. Have you tried that > instead? I tried to use pty.fork() but it also produces the same error. I also tried passing 'r', and 'rb' to fdopen() but it didn't make any difference. -a -- http://mail

Re: os.fdopen() issue in Python 3.1?

2010-03-02 Thread Albert Hopkins
This appears to be Issue 5380[1] which is still open. I've cc'ed myself to that issue. [1] http://bugs.python.org/issue5380 -- http://mail.python.org/mailman/listinfo/python-list

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

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() > >

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: 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: (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

<    1   2   3   >