Re: When I use Python under Windows. I found some file handles are not closed,

2011-11-01 Thread Gabriel Genellina
the Python version you're using. Also, a small, complete, runnable code example showing the problem would be very valuable. Usually, in building such example, you may well find out where your problem is. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Fast recursive generators?

2011-10-28 Thread Gabriel Genellina
s print list(itertools.islice(my_generator(), 10)) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: why msvcrt.printf show the first char only?

2011-10-15 Thread Gabriel Genellina
ng, and stops as soon as it sees the '\0' following the 'T' in 'Testing'. Either use wprintf("Testing..."), or encode the Unicode object into a byte string before calling: printf("Testing...".encode(sys.stdout.encoding)), or tell ctypes about the right parameter type: printf = msvcrt.printf printf.argtypes = [c_char_p] printf("Testing\n") -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Deleting files on a shared server

2011-10-07 Thread Gabriel Genellina
open. [1] http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/openfiles.mspx -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: socket.getsockname is returning junk!!

2011-10-07 Thread Gabriel Genellina
1) I'd say it's a problem with the _socket module; did the unit tests flag anything when you built Python? On Windows, Python 2.7.1: server_address=('lepton', 1) sock.bind(server_address) sock.getsockname() ('127.0.0.1', 1) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: sending ftp file list to mail???

2011-10-07 Thread Gabriel Genellina
s a string. retrlines, by default, outputs to stdout, isn't very useful. Try this: def posta_olustur(): ... lines = [] baglanti.retrlines("LIST", lines.append) text = '\n'.join(lines) posta.attach(MIMEText(text)) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: sending ftp file list to mail???

2011-10-07 Thread Gabriel Genellina
En Fri, 07 Oct 2011 03:23:57 -0300, selahattin ay escribió: hi all. I want to get my ftp list and send the list to my mail adress... my codes are And your problem is...? -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: How to inspect slot wrappers arguments in Python?

2011-10-07 Thread Gabriel Genellina
ments is encoded in its 'format' parameter, and is not stored anywhere. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: database connection

2011-10-07 Thread Gabriel Genellina
user who can read the database file can connect to it. sqlite does not have internal users, and does not implement GRANT/REVOKE statements. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Is exec() also not used in python 2.7.1 anymore?

2011-10-04 Thread Gabriel Genellina
block, or perhaps locals(); # modify accordingly -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: BaseHTTPServer ThreadMixIn not working

2011-10-04 Thread Gabriel Genellina
invalid and knows she cannot re-use the received body and has to issue the second request and waits again and ... Try with different URLs for each request: http://localhost:8080/a http://localhost:8080/b http://localhost:8080/c and you'll see they all are processed in parallel. -- Ga

Re: Change import order with *.pth files

2011-10-03 Thread Gabriel Genellina
set the PYTHONPATH environment variable, or edit the site.py standard module. This may be fine in your development environment, but I would never do that in production. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Installing Python 2.6.7 on Windows

2011-09-28 Thread Gabriel Genellina
2.6.7 (or apply only the .py changes) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: syntactic sugar for def?

2011-09-28 Thread Gabriel Genellina
STORE_NAME 0 (foo) 9 LOAD_CONST 1 (None) 12 RETURN_VALUE To get at the actual function code, one should use f.func_code.co_consts[0]; this would be the 'code' parameter for types.FunctionType. Very complicated, really; nothing can beat the 'def' statement for defining a function ;) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Error 'module' object has no attribute "_extension_registry" when cPickle is imported from an installed Python 2.7.1

2011-09-27 Thread Gabriel Genellina
odule' object has no attribute '_extension_registry' Looking at cPickle.c, it imports the copy_reg module and then looks for its "_extension_registry" attribute. Maybe your copy_reg.py is broken, or you have another copy_reg.py hiding the standard one. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Handling 2.7 and 3.0 Versions of Dict

2011-09-02 Thread Gabriel Genellina
En Fri, 02 Sep 2011 13:53:37 -0300, Travis Parks escribió: On Sep 2, 12:36 pm, "Gabriel Genellina" wrote: En Wed, 31 Aug 2011 22:28:09 -0300, Travis Parks escribi : > On Aug 31, 7:37 pm, Gregory Ewing wrote: >> Ian Kelly wrote: >> > if sys.version_info &l

Re: Invoking profile from command line prevent my sys.path modification

2011-09-02 Thread Gabriel Genellina
hon.org/install/index.html#modifying-python-s-search-path -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Help required accessing dictionary

2011-09-02 Thread Gabriel Genellina
s((op)->ob_type, Py_TPFLAGS_INT_SUBCLASS) /* from object.h */ #define PyType_FastSubclass(t,f) PyType_HasFeature(t,f) #define PyType_HasFeature(t,f) (((t)->tp_flags & (f)) != 0) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Handling 2.7 and 3.0 Versions of Dict

2011-09-02 Thread Gabriel Genellina
ctValues, despite being "indented", is defined at global scope, and may be used anywhere in the module. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling Script from Command line not working

2011-09-01 Thread Gabriel Genellina
e = None cyg.cygwin_dll_init() #hangs or returns here ... Anyway, I don't see why a console application would fail but not inside IDLE. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Execute a method in a file in an egg

2011-08-24 Thread Gabriel Genellina
En Tue, 23 Aug 2011 13:14:06 -0300, RVince escribió: Is there a way to do this from the command line? Thanks. Something like this? python -c "import the.module;the.module.someclass().method(arguments)" -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: from module import * using __import__?

2011-07-04 Thread Gabriel Genellina
quot;import pickle" in your code; if the fast module is present, it is automatically loaded and used; else, the slow but compatible version is used. You don't even have to know that an alternative implementation exists. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: search through this list's email archives

2011-06-24 Thread Gabriel Genellina
En Fri, 24 Jun 2011 11:33:23 -0300, Grant Edwards escribió: On 2011-06-24, Gabriel Genellina wrote: En Thu, 23 Jun 2011 13:11:32 -0300, Cathy James escribi?: I looked through this forum's archives, but I can't find a way to search for a topic through the archive. Am I missing

Re: search through this list's email archives

2011-06-24 Thread Gabriel Genellina
En Thu, 23 Jun 2011 13:11:32 -0300, Cathy James escribió: I looked through this forum's archives, but I can't find a way to search for a topic through the archive. Am I missing something? Gmane provides a search capability also: http://blog.gmane.org/gmane.comp.python.general

Re: Python 2.7.2 for Windows reports version as 2.7.0?

2011-06-22 Thread Gabriel Genellina
0 twice, "for all users" and also "for current user only", and both in the same directory (c:\python27). That could explain the old .dll in the install directory; the new one goes into system32, but the old one takes precedence. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Unsupported operand type(s) for +: 'float' and 'tuple'

2011-06-10 Thread Gabriel Genellina
above, I'd avoid using indexes, take two random nodes using random.sample instead, and avoid adjacency_list(): while True: a, b = random.sample(nod, 2) if b not in G[a]: break GG.add_edge(a, b) (mmm, I'm unsure of the adjacency test, I've used networkx some time ago but I don't have it available right now) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Unsupported operand type(s) for +: 'float' and 'tuple'

2011-06-10 Thread Gabriel Genellina
above, I'd avoid using indexes, take two random nodes using random.sample instead, and avoid adjacency_list(): while True: a, b = random.sample(nod, 2) if b not in G[a]: break GG.add_edge(a, b) (mmm, I'm unsure of the adjacency test, I've used networkx some time ago but I don't have it available right now) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: help on QUICKFIX

2011-06-10 Thread Gabriel Genellina
a mailing list - I think you'll get more help there. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems Compiling Python 2.6.7 for Win7

2011-06-08 Thread Gabriel Genellina
st of the other sources claiming to provide it. Doesn't http://www.microsoft.com/express/Downloads/#2008-Visual-CPP work for you? I didn't try past the initial download prompt, but it seems to be the right version. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Function call arguments in stack trace?

2011-06-07 Thread Gabriel Genellina
ack.py in c(foo=90, bar=1) 26 "This is function c" 27 baz = foo+bar 28 spam.somenamethatdoesnotexist(foo+bar) 29 anotherglobal("thatdoesnotexisteither") 30 global spam = [] spam.somenamethatdoesnotexist undefined foo = 90 bar = 1 AttributeError: 'list

Re: sys.tracebacklimit not working in Python 3.2?

2011-06-07 Thread Gabriel Genellina
issue12276 -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Print Window on IDLE

2011-06-06 Thread Gabriel Genellina
the [General] section: print-command-posix=lpr %%s print-command-win=start /min notepad /p %%s (%s should become %%s). Tested on Windows, but Linux should have the same problem and temporary solution. You may need to roll this change back when the code is corrected. Reported as http://bugs.python.org/issue12274 -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: GIL in alternative implementations

2011-06-06 Thread Gabriel Genellina
change its meaning from one iteration to the next, so a complete name lookup is required at each iteration. This is very useful sometimes, but affects performance a lot. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: except KeyError, everywhere

2011-06-06 Thread Gabriel Genellina
lementation in the standard library Yes, there is, in Python 3.2: http://docs.python.org/py3k/library/functools.html#functools.lru_cache -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Alternatives to PythonPath

2011-05-31 Thread Gabriel Genellina
(2.6 and up), on Windows it is located at %APPDATA%\Python\PythonXX\site-packages. Every user gets its own %APPDATA% directory, with read and write permissions. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to compute length of arbitrary dimension vector?

2011-05-30 Thread Gabriel Genellina
py> py> def f1(*args): ... return math.sqrt(sum(x*x for x in args)) ... py> def f2(*args): ... return math.sqrt(math.fsum(x*x for x in args)) ... py> pi=math.pi py> args=[pi]*16 py> abs(f1(*args)/4 - pi) 4.4408920985006262e-16 py> abs(f2(*args)/4 - pi) 0.0 -- Gabriel G

Re: pexpect: TIMEOUT no longer clears child.before

2011-05-25 Thread Gabriel Genellina
he author: www.noah.org -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Hotshoting recursive function

2011-05-25 Thread Gabriel Genellina
not raise ProfileError anymore. Interpreting profile data is up to you... -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiple file select with tkFileDialog passes back 'decorated' strings (sometimes)

2011-05-23 Thread Gabriel Genellina
arse both, not an issue but it raises the question: Are these the only two possibilities? Is it the same across platforms (I use Python 2.7 on Win Vista)? An old bug. See http://bugs.python.org/issue5712 for a workaround. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: cPickle -> invalid signature

2011-05-17 Thread Gabriel Genellina
En Tue, 17 May 2011 15:26:53 -0300, Neal Becker escribió: Gabriel Genellina wrote: En Tue, 17 May 2011 08:41:41 -0300, Neal Becker escribió: What does it mean when cPickle.load says: RuntimeError: invalid signature Is binary format not portable? Are you sure that's the actual

Re: cPickle -> invalid signature

2011-05-17 Thread Gabriel Genellina
En Tue, 17 May 2011 15:26:53 -0300, Neal Becker escribió: Gabriel Genellina wrote: En Tue, 17 May 2011 08:41:41 -0300, Neal Becker escribió: What does it mean when cPickle.load says: RuntimeError: invalid signature Is binary format not portable? Are you sure that's the actual

Re: FW: help please

2011-05-17 Thread Gabriel Genellina
se refresh my memory? -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: cPickle -> invalid signature

2011-05-17 Thread Gabriel Genellina
quite portable, even cross-version. As a generic answer, make sure you open the file in binary mode, both when writing and reading. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: FW: help please

2011-05-17 Thread Gabriel Genellina
ld be the python-win32 list: http://mail.python.org/mailman/listinfo/python-win32 Good luck! -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Datetime.timedelta

2011-05-17 Thread Gabriel Genellina
elta + hours datetime.timedelta(1, 37800) py> def dhms_from_timedelta(td): ... return td.days, td.seconds // 3600, (td.seconds % 3600) // 60, td.seconds % 60 ... py> dhms_from_timedelta(delta + hours) (1, 10, 30, 0) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: turn monitor off and on

2011-05-16 Thread Gabriel Genellina
is buggy or does not implement the required functionality. Mine is from Philips. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Import on case insensitive filesystem

2011-05-16 Thread Gabriel Genellina
g/dev/peps/pep-0235/ for details. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Peculiar Behaviour of __builtins__

2011-05-12 Thread Gabriel Genellina
En Thu, 12 May 2011 22:59:24 -0300, Gabriel Genellina escribió: En Thu, 12 May 2011 20:29:57 -0300, Aman Nijhawan escribió: I was trying to call the builtin function min by using getattr(__builtins__,'min') This works at the interpretter prompt However when I called it insid

Re: Peculiar Behaviour of __builtins__

2011-05-12 Thread Gabriel Genellina
://docs.python.org/library/__builtin__.html Note: using getattr with a literal name is not so useful. Better to use dot notation. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: NewBie Doubt in Python Thread Programming

2011-05-11 Thread Gabriel Genellina
tiveCount is the original Java spelling. 5. is there a way to find out if the thread is still active or dead? Yes, use is_alive() -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: This it is the code of tmb_import.py (to matter of .tmb to blender) I need tmb_exporter.py (to export of blender to .tmb) Thanks.

2011-05-10 Thread Gabriel Genellina
, así que tal vez te convenga preguntar en un foro como: http://www.g-blender.org/ (específicamente dedicado a Blender 3D en español) También está la comunidad de Python Argentina: http://python.org.ar/pyar/ (busca la lista de correo) Suerte! -- Gabriel Genellina -- http://mail.python.org

Re: Testing tools classification

2011-05-09 Thread Gabriel Genellina
En Sat, 07 May 2011 02:21:02 -0300, rusi escribió: There is this nice page of testing tools taxonomy: http://pycheesecake.org/wiki/PythonTestingToolsTaxonomy But it does not list staf: http://staf.sourceforge.net/index.php. The good thing about wikis is, you can add it yourself. -- Gabriel

Re: How to upload a file

2011-04-28 Thread Gabriel Genellina
battery isn't included (yet - see http://bugs.python.org/issue3244) but this little library may help: https://bitbucket.org/chrisatlee/poster -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Access violation reading 0x00000010

2011-04-28 Thread Gabriel Genellina
those two lines of code, I'd say the problem is inside SIM_init() itself. It may be attempting to dereference a NULL pointer: accessing a field inside a struct, or calling a virtual function from a NULL object... Also, make sure CDLL is the right choice; it implies a prototype like t

Re: argparse parser stores lists instead of strings

2011-04-28 Thread Gabriel Genellina
ng, but that's not really something I want to do, especially if I start adding more options. That's because of nargs=1. From the argparse documentation: [1] Note that nargs=1 produces a list of one item. This is different from the default, in which the item is produced by itself. So, just remove nargs=1 from add_argument() [1] http://docs.python.org/py3k/library/argparse.html#nargs -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: PYTHONPATH

2011-04-15 Thread Gabriel Genellina
ories like ~/.local/lib/python2.6/site-packages and %APPDATA%\Python\Python26\site-packages (see PEP370 [1] for details) so you don't even have to mess with the Python installation directories. [1] http://www.python.org/dev/peps/pep-0370/ -- Gabriel Genellina -- http://mail.python.org/m

Re: How to build and upload eggs to pypi?

2011-03-22 Thread Gabriel Genellina
l: http://wiki.python.org/moin/CheeseShopTutorial To add a new version, simply increment the version number, and then "python setup.py upload" should be enough. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: puzzle about file Object.readlines()

2011-03-22 Thread Gabriel Genellina
MS-DOS, which borrowed from CP/M, an > > operating > > system which stored the file size as the number of 128-byte records. > > chr(26) was used to > > indicate where the text ended in the last record. > > On Win a ctrl-z is end of file.  So if you want to read beyond the end > of a text file, you have to pretend it's binary.  Open it with  "rb" > instead of "r" Using mode "rU" may be more convenient, because it still translates \r \n into \n but disregards chr(26) as a special marker. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: favicon.ico problem

2010-08-11 Thread Gabriel Genellina
; comes from. Any insight into this weird behavior would be greatly appreciated. It't the browser attempting to get an icon for the page. See http://en.wikipedia.org/wiki/Favicon -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: easy question on parsing python: "is not None"

2010-08-09 Thread Gabriel Genellina
s using the is operator only if you can guarantee that both operands are alive at the same time. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: easy question on parsing python: "is not None"

2010-08-07 Thread Gabriel Genellina
is False (like NANs). -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: abstract metaclass

2010-08-06 Thread Gabriel Genellina
ery type is just an object, isn't it? This may be an oversight in ABCMeta implementation - please file a bug report at http://bugs.python.org/ -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: How to read large amounts of output via popen

2010-08-06 Thread Gabriel Genellina
myfile = open('/home/john/myoutputfile','w') myerror = open('/home/john/myerrorfile','w') process=subprocess.Popen(['myscript', 'param1'], shell=False,stdout=myfile,stderr=myerror) process.wait() (untested) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Byte Offsets of Tokens, Ngrams and Sentences?

2010-08-06 Thread Gabriel Genellina
a string. Output: This 0 is 5 a 8 string. 10 Like this? py> import re py> s = "This is a string." py> for g in re.finditer("\S+", s): ... print g.group(), g.start() ... This 0 is 5 a 8 string. 10 -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Urrlib2 IncompleteRead error

2010-08-04 Thread Gabriel Genellina
a server error; a chunked transfer encoding finished before reaching the expected size. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: encodings.idna.ToASCII( unicodeStr ) != unicodeStr.encode( 'idna' )

2010-06-23 Thread Gabriel Genellina
7;) -- and encode/decode('idna') takes the whole name, splits, and processes each label (following RFC 3490, I presume) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: adding new function

2010-06-23 Thread Gabriel Genellina
ython import mymod mymod.fname = somefunc #or setattr(mymod, namestring, funcobject) I presume you use the C-API equivalent of setattr. That one, or PyModule_AddObject (just for nicer error messages really). -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Unicode file names with ftplib and encodings.idna as a workaround?

2010-06-22 Thread Gabriel Genellina
be for our PHP and shell scripters. (Just checked: There's a PEAR module for PHP4/5; oddly enough nothing pops up for .NET IDNA libraries) The server software must be able to convert from file system encoding to utf-8 and viceversa; check its configuration. -- Gabriel Genellina -- http://ma

Re: Strange factory pattern

2010-06-22 Thread Gabriel Genellina
ation only." And those classes have a big "*** DO NOT SUBCLASS THIS CLASS ***" message. The message never made into the documentation. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: "isinstance" question

2010-06-22 Thread Gabriel Genellina
ject; in the second one, you do. foo is a "classic" class (or "old-style" class); x is an instance of foo, its *type* is InstanceType, its *class* is foo. All instances of any other classic class have the same type (InstanceType). bar is a "new-style" clas

Re: Serialization, save type information in file and restore them

2010-06-22 Thread Gabriel Genellina
arated). (You may use any format you want, but why reinvent it, and you may even find an existing RDB parser/writer in Python) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: question about multiprocessing

2010-06-22 Thread Gabriel Genellina
pickle a lambda expression - functions must have a name and be available at the outermost module level. (See "Programming guidelines" in the multiprocessing documentation, and the pickle module) But you can't share a Queue object - use the multiprocessing one (see "E

Re: variable variables

2010-06-18 Thread Gabriel Genellina
r name = "spam" getattr(some_object, name) == some_object.spam == getattr(some_object, "spam") -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Overriding "__setattr__" of a module - possible?

2010-06-17 Thread Gabriel Genellina
ompromise. Seems interesting...! -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Overriding "__setattr__" of a module - possible?

2010-06-17 Thread Gabriel Genellina
En Thu, 17 Jun 2010 07:12:23 -0300, Fuzzyman escribió: On Jun 17, 10:29 am, "Gabriel Genellina" wrote: En Thu, 17 Jun 2010 04:52:48 -0300, Alf P. Steinbach escribió: > But who would have thunk that Python *isn't dynamic enough*? :-) Yep... There are other examples t

Re: Overriding "__setattr__" of a module - possible?

2010-06-17 Thread Gabriel Genellina
En Thu, 17 Jun 2010 04:52:48 -0300, Alf P. Steinbach escribió: * Gabriel Genellina, on 17.06.2010 09:25: En Wed, 16 Jun 2010 19:56:39 -0300, Ian Kelly escribió: On Wed, Jun 16, 2010 at 3:38 PM, John Nagle wrote: That just leaves things in a state where even "sys" and &q

Re: basic doubt

2010-06-17 Thread Gabriel Genellina
s is just a guess, but looks like your h function is a plain function, not a method, so it doesn't take a "self" parameter. Also, you are probably using it in some place where the callback doesn't receive any additional arguments (like a Button command). Try with def f():

Re: Overriding "__setattr__" of a module - possible?

2010-06-17 Thread Gabriel Genellina
verriden __getitem__/__setitem__ methods (an optimization, surely). I'm afraid it will be hard to intercept global variable usage in these circumstances. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: First program

2010-06-15 Thread Gabriel Genellina
ut to avoid problems, it's better to use the right tools for the OS you're working with (that is, don't use notepad to edit Linux files...) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: File descriptor to file object

2010-06-15 Thread Gabriel Genellina
fdopen(...) fdopen(fd [, mode='r' [, bufsize]]) -> file_object Return an open file object connected to a file descriptor. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Capture the request/response log for local web server through python.

2010-06-14 Thread Gabriel Genellina
equest - using sys.stderr, but you may override log_message() if you want: http://docs.python.org/library/basehttpserver.html#BaseHTTPServer.BaseHTTPRequestHandler.log_message If you want to log the response, do that in the request handler, a good place would be at the end of your do_GET() method

Re: sir

2010-06-11 Thread Gabriel Genellina
not supposed to actually include them. They indicate an optional section, e.g., given this description: FTP.connect(host[, port[, timeout]]) you may invoke the method as: connect(host) connect(host, port) connect(host, port, timeout) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Py_single_input and the side-effects...

2010-06-05 Thread Gabriel Genellina
introduction.html#using-python-as-a-calculator -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: reading help() - newbie question

2010-06-05 Thread Gabriel Genellina
count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse' , 'sort'] you get this instead: py> see(pencil_case) [] in ++= **= <<= == != >>= hash() help() iter() len()repr() reversed() str().append().count() .extend().index() .insert().pop() .remove().reverse() .sort() For us mere mortals, it's a lot more readable. "see" is available at http://github.com/inky/see -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Missing DLL in win98

2010-06-05 Thread Gabriel Genellina
ious, without closely reading your original post... > > So it WAS obvious to anyone who was PAYING ATTENTION? It is not obvious to me at least, even after closely reading your post. All I can deduce from it is that you assumed you would have a better chance upgrading your OS, not that you

Re: General questions - where & how

2010-06-05 Thread Gabriel Genellina
> lists/groups that are more specialized. I have no idea about comparitive > performance. In addition, Google Groups mirrors this list too as http://groups.google.com/group/comp.lang.python/ -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: changing format of time duration.

2010-06-05 Thread Gabriel Genellina
d try (still untested): def nice_timedelta_str(d): result = str(d) if result[1] == ':': result = '0' + result return result delta = now2-now1 print nice_timedelta_str(delta) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: changing format of time duration.

2010-06-03 Thread Gabriel Genellina
hod or a quick hack > to add an extra zero in the beginning. > > So the result I am looking for would be 00:00:00.11221 Try the strptime method with a suitable format, like this (untested): delta = now2-now1 delta.strftime('%H:%M:%S.%f') http://docs.python.org/library/datetime.

Re: PEP 3119 ABC - And how I learned to love the Abstract Bomb

2010-05-11 Thread Gabriel Genellina
you need not implement the second, and vice versa, so my second requirement is: 2. Conditional Abstractness! if certain methods are not implemented then be able to require some method to be implemented. Mmm, can't you use two separate ABCs? Perhaps inheriting from a common base. -- Ga

Re: open(False) in python3

2010-05-11 Thread Gabriel Genellina
some text ^Z ^Z 'Type some text\n' p3> Should I chalk this up to stupid coder syndrome or file a bug report? Uhm, perhaps the bug is, bool should not inherit from int in Python 3, but it's way too late to change that. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Embedding, no correct lib

2010-05-05 Thread Gabriel Genellina
nd it may conflict with an existing installation. The reverse is true too: a PYTHONPATH variable set for the "system" Python will interfere with your private copy too. Global state is always a bad idea.) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: find out whther byte two .pyc files contain the same byte code.

2010-05-05 Thread Gabriel Genellina
source file. Just ignore the first 8 bytes when computing the checksum: tail -c +8 tst.pyc | md5sum (untested) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Fast Efficient way to transfer an object to another list

2010-05-04 Thread Gabriel Genellina
ist.append(stock) del old_list[index] # I would not return anything -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: CGI python 3 write RAW BINARY

2010-05-04 Thread Gabriel Genellina
len(data) f.close() print("Content-Type: image/jpeg\nContent-Length: %d\n" % l) sys.stdout.flush() sys.stdout.buffer.write( data ) (Probably, a better way would be to replace all those \n with \r\n, and not use print at all, but the above code is good enough). -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: problem when running .py file

2010-04-23 Thread Gabriel Genellina
data." Did you install all of them? triMC3D doesn't appear to be widely used, so better ask the author for further advice. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Smtpd module

2010-04-23 Thread Gabriel Genellina
must understand AUTH command. I think there was a recipe doing AUTH in code.activestate.com -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: question about an exciting gotcha for unittests (and elsewhere) ...

2010-04-23 Thread Gabriel Genellina
port the node module the same way the real application would do. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: PLEASE HELP--Button images refuse to show.

2010-04-22 Thread Gabriel Genellina
ack(): b.config(image=image, text='', width=image.width(), height=image.height()) (btw, notice usage of config() to set widget attributes, and implicit line continuation instead of \ ) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: How to read file during module import?

2010-04-22 Thread Gabriel Genellina
En Sun, 18 Apr 2010 22:21:40 -0300, HigStar escribió: On Apr 13, 4:03 am, "Gabriel Genellina" wrote: En Sun, 11 Apr 2010 19:43:03 -0300,HigStar escribió: > I have had trouble with the __file__ attribute in the past, when using > py2exe (i.e. on the windows platform) and

Re: feature request for a wget -r like implementation in python3

2010-04-16 Thread Gabriel Genellina
En Thu, 15 Apr 2010 16:37:37 -0300, gert escribió: [a wget -r like implementation in python3] So I can make a recursive http download script What about calling wget itself? subprocess.call(['wget',...]) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   7   8   9   10   >