Re: Why use "locals()"

2009-09-13 Thread Gabriel Genellina
thread/449eb9b835a472e7/ see also this recipe http://code.activestate.com/recipes/576742/ ) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Python C/API Problem

2009-09-11 Thread Gabriel Genellina
ut or Py_single_input - not 0. Anyway, if this is the actual cause of your segfault, seems that a validation should be added somewhere... -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about unpickling dict subclass with custom __setstate__

2009-09-11 Thread Gabriel Genellina
the unpickle phase? In other words, should I run super(Entity, self).__setstate__(d) or something like that? That doesn't work, dict.__setstate__ doesn't even exist. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Q on explicitly calling file.close

2009-09-11 Thread Gabriel Genellina
ing. I'd say everyone should be aware of that, giving the ample usage of exceptions in Python, but looks like people requires a reminder from time to time. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Q on explicitly calling file.close

2009-09-07 Thread Gabriel Genellina
ld be inside a finally clause. The with statement isn't about never having to type try again, I don't think. The with statement is intended as a replacement for common try/finally blocks, not try/except blocks as the OP seems to imply. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Noddy with submodules?

2009-09-07 Thread Gabriel Genellina
ort *" (_elementtree being a C extension) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: How to refer to data files without hardcoding paths?

2009-09-07 Thread Gabriel Genellina
that directory. But that doesn't work if some components aren't actually on the filesystem (egg files, zipped libraries, or programs deployed using py2exe or similar). I prefer to use pkgutil.get_data(packagename, resourcename) because it can handle those cases too. -- Gabriel Genellina

Re: Windows binaries of python in debug mode

2009-09-07 Thread Gabriel Genellina
ou'll require *all* the C extensions you use compiled in debug mode too. This usually means that you have to recompile all of them from source. In that case, having to recompile Python itself doesn't impose much additional work, and you are free of compiler mismatch issues. -- Ga

Re: how to edit .wsgi file extebtions with IDLE on windows

2009-09-03 Thread Gabriel Genellina
En Sat, 29 Aug 2009 20:29:43 -0300, gert escribió: On Aug 29, 11:16 pm, "Gabriel Genellina" wrote: En Sat, 29 Aug 2009 17:14:14 -0300, gert escribió: > On Aug 29, 9:31 pm, Chris Rebert wrote: >> On Sat, Aug 29, 2009 at 5:40 AM, gert wrote: >> > On Aug 29,

Re: The future of Python immutability

2009-09-03 Thread Gabriel Genellina
immutable ones. This must be a writable field - and here you have your race condition, even for immutable objects. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Unable to install pywin32 for Python 2.6.2

2009-09-02 Thread Gabriel Genellina
installed Python into C:\Python26, then C:\Python26\Lib\site-packages is already on your Python search path; you don't even need to set PYTHONPATH at all. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes WNetGetUniversalNameW

2009-09-02 Thread Gabriel Genellina
dereference the pointer and access its (only) field print puni.contents.lpUniversalName -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: website feedback to where?

2009-09-02 Thread Gabriel Genellina
wser (FF3.5), so please be more specific. search for "This is a rather long string containing" I suppose this is more of a documentation bug... patch submitted: http://bugs.python.org/issue6828 -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Python-URL! - weekly Python news and links (Sep 2)

2009-09-02 Thread Gabriel Genellina
QOTW: "I like how being very friendly means calling people after a guy who tried to blow up the English Parliament." - Carl Banks http://groups.google.com/group/comp.lang.python/browse_thread/thread/7a190c24d8025bb4 unichr/ord cannot handle characters outside the BMP in a narrow build:

Re: An assessment of the Unicode standard

2009-09-02 Thread Gabriel Genellina
En Wed, 02 Sep 2009 04:58:43 -0300, Hendrik van Rooyen escribió: On Wednesday 02 September 2009 08:52:55 Gabriel Genellina wrote: Bueno, voy a escribir en el segundo lenguaje más hablado en el mundo (español), después del mandarín (con más de 1000 millones de personas). What do you call

Re: An assessment of the Unicode standard

2009-09-01 Thread Gabriel Genellina
cer puesto, con menos de la mitad de hablantes (500 millones). Si no me entendés, jodete. Fuente: http://www.wolframalpha.com/input/?i=languages+in+the+world -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Daemon process

2009-09-01 Thread Gabriel Genellina
an you see the process running (ps)? Can you see the port open (netstat)? Can you connect to the server using telnet, from the same host? -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Every thing on a database

2009-09-01 Thread Gabriel Genellina
ly a mess, due to successive patches over patches; hard to understand without a historical perspective) Brett Cannon is working on a pure Python implementation for import, and I think some kind of sqlite importer is in the plans... -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: starting a client remotely

2009-08-31 Thread Gabriel Genellina
rior to the Triasic-Jurasic extinction event :) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: map

2009-08-31 Thread Gabriel Genellina
ally easier to read). *ducks away from the inevitable flames* *fights back to back with you against heretics* -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: lambda functions

2009-08-31 Thread Gabriel Genellina
usage here" for index,item in enumerate(s): s[index] -= 1 -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Popen question (redundant processes)

2009-08-30 Thread Gabriel Genellina
e you specified to tee. In addition to that, you can avoid the cat command (and omit p1 completely), just pass the georgi file as p2 stdin: p2 = Popen(["fit_coeffs"], stdin=open("georgi..."), ... In other words, the original shell commands are: cat georgi.dat | fit | r

Re: Object's nesting scope

2009-08-29 Thread Gabriel Genellina
En Sat, 29 Aug 2009 04:34:48 -0300, zaur escribió: On 29 авг, 08:37, "Gabriel Genellina" wrote: En Fri, 28 Aug 2009 15:25:55 -0300, zaur escribió: > On 28 авг, 16:07, Bruno Desthuilliers 42.desthuilli...@websiteburo.invalid> wrote: >> zaur a écrit : >> >

Re: how to edit .wsgi file extebtions with IDLE on windows

2009-08-29 Thread Gabriel Genellina
En Sat, 29 Aug 2009 17:14:14 -0300, gert escribió: On Aug 29, 9:31 pm, Chris Rebert wrote: On Sat, Aug 29, 2009 at 5:40 AM, gert wrote: > On Aug 29, 6:43 am, "Gabriel Genellina" > wrote: >> En Fri, 28 Aug 2009 15:31:31 -0300, gert escribió: >> > I can

Re: Monitoring stdout in (more or less) real time

2009-08-29 Thread Gabriel Genellina
cess it line by line, I presume. I'd use a second thread to read the pipe and put the lines onto a Queue object; the main thread gets lines from the Queue when available. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: copy construtor question

2009-08-28 Thread Gabriel Genellina
://docs.python.org/library/copy.html -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: how to edit .wsgi file extebtions with IDLE on windows

2009-08-28 Thread Gabriel Genellina
file type (the one used for .py files): D:\USERDATA\Gabriel>assoc .py .py=Python.File D:\USERDATA\Gabriel>assoc .wsgi=Python.File .wsgi=Python.File -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Object's nesting scope

2009-08-28 Thread Gabriel Genellina
e Person.init = the_initializer_i_would_like person = Person() person.init(name="john", age=30) 4) def a_generic_updater(obj, **kw): try: ns = vars(obj) except Exception: ns = None if ns is not None: ns.update(kw) else: for name in kw: setattr(obj, name, kw[name]) person = Person() a_generic_updater(person, name="john", age=30) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Raw data extraction question

2009-08-28 Thread Gabriel Genellina
. Basically i need ONLY raw data extracted from line 1 - onward. How does a line look like? Post some sample lines. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Question on the "csv" library

2009-08-28 Thread Gabriel Genellina
ss you'll get quotes around text containing ';' characters But, perhaps, there is no standard alternative to CSV !!! Of course there are! You may use SYLK, DIFF, XML, XDR... "The nice thing about standards is that there are so many to choose from." (Andrew

Re: Object's nesting scope

2009-08-28 Thread Gabriel Genellina
r than just saving typing and implicit attribute access. But you *are* doing implicit attribute access. Anyway, the topic was raised and rejected several times in the past; see this recent thread in the python-ideas list: http://comments.gmane.org/gmane.comp.python.ideas/5518 -- Gabriel Genel

Re: Transforming a str to an operator

2009-08-28 Thread Gabriel Genellina
ompt = "Select an operator ({}):".format(','.join(op for op in op_funcs)) op_prompt = "Select an operator ({}):".format(','.join(op_funcs)) Just fixing the code a little to be more "Pythonic" ;). Even more ;) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Annoying octal notation

2009-08-24 Thread Gabriel Genellina
En Mon, 24 Aug 2009 14:40:24 -0300, Derek Martin escribió: Why is it so hard for you to accept that intelligent people can disagree with you, and that what's right for you might be bad for others? Ask the same question yourself please. -- Gabriel Genellina -- http://mail.pytho

Python-URL! - weekly Python news and links (Aug 23)

2009-08-23 Thread Gabriel Genellina
QOTW: "... [O]nce you accept that text is best handled in Unicode, there's little sense in making an exception for the limited subset that happens to be representable in ASCII." - Ben Finney http://groups.google.com/group/comp.lang.python/msg/accc8c2ae9d7ed15 Python 3.1.1 released:

Re: Zipimport leaks memory?

2009-08-21 Thread Gabriel Genellina
I didn't read the source, but isn't that the expected behavior? If the module is still referenced by zip_directory_cache, the reference count must be 1 or more. Maybe zip_directory_cache should be cleared at interpreter shutdown? -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: difference between 2 arrays

2009-08-21 Thread Gabriel Genellina
et (builtin) The best: read the documentaion of the module, and use the builtin... Any suggestion to improve the builtin set documentation? In what ways do you see one is better than the other? -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Python-URL! - weekly Python news and links (Aug 15)

2009-08-15 Thread Gabriel Genellina
QOTW: "They questioned my competence and that made her very sad." - Roger Wallis,expert witness for Pirate Bay, on his wife http://torrentfreak.com/pirate-bay-witness-wife-overwhelmed-with-flowers-090227/ unicode(s) is, surprisingly, MUCH faster (for certain encodings) than s.decode

Re: Splitting a string into substrings of equal size

2009-08-14 Thread Gabriel Genellina
o this rather complicated code: Mine isn't very simple either: py> def genparts(z): ... n = len(z) ... i = n%3 ... if i: yield z[:i] ... for i in xrange(i, n, 3): ... yield z[i:i+3] ... py> ','.join(genparts("75096042068045")) '75,096,042,068,045' -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling parent constructor with different argument list

2009-08-14 Thread Gabriel Genellina
s.python.org/reference/datamodel.html#basic-customization -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: OptionParser How to: prog [options] [arguments]

2009-08-14 Thread Gabriel Genellina
tionParser? Extract the yourself, and pass the remaining arguments (that is, sys.argv[2:]) to parser.parse_args() -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: trouble with reload

2009-08-14 Thread Gabriel Genellina
it is very useful for interactive use once you get it's quirks. Is it gone-gone or just removed from built-ins? Just relocated: p3> import imp p3> imp.reload -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Delegate attribute requests to object

2009-08-13 Thread Gabriel Genellina
another approach for new-style classes (maybe not production-ready yet). And this recipe [2] shows how to make the decorated object keep calling methods on the decorator itself. [1] http://code.activestate.com/recipes/252151/ [2] http://code.activestate.com/recipes/519639/ [3] http

Re: Unsigned char array to an unsigned longlong array

2009-08-13 Thread Gabriel Genellina
le (52 bits), and the exponent is: py> hex(-895+1023) '0x80' So that value seems OK to me, at least with IEEE 754 hardware... -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Monkeypatching an object to become callable

2009-08-13 Thread Gabriel Genellina
e (e.g. builtin types). -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: inspect.stack() performance

2009-08-12 Thread Gabriel Genellina
g linecache). If all you want is module name + line number, use this: f = sys._getframe() print f.f_globals['__name__'], f.f_lineno (see a recent post about warnings.warn too) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: How to page output in >>> ?

2009-08-12 Thread Gabriel Genellina
> |print $long_output Try using pydoc.pager - read the source -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: How to find out in which module an instance of a class is created?

2009-08-12 Thread Gabriel Genellina
try/except around sys._getframe(1) is because that function is not mandatory/available on all Python implementations (that's the case for jython which doesn't provide it). -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Format Code Repeat Counts?

2009-08-12 Thread Gabriel Genellina
, using {} auto-numbering (requires Python 3.1 or the future 2.7) p3> letters = ["aeiou", "hnopty", "egs", "amsp"] p3> ("[{}]"*len(letters)).format(*letters) '[aeiou][hnopty][egs][amsp]' -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: fileinput

2009-08-12 Thread Gabriel Genellina
en+seek is the way to do that (assuming you don't alter the line length) [1] http://docs.python.org/library/fileinput.html#fileinput.input -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Changing Remote Registry

2009-08-12 Thread Gabriel Genellina
check your actual permissions under the Edit menu. Also, try using KEY_WRITE instead of KEY_SET_VALUE. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Python configuration question when python scripts are executed using Appweb as web server.

2009-08-10 Thread Gabriel Genellina
5).aspx [2] http://mail.python.org/mailman/listinfo/distutils-sig -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: importing fully qualified scripts to check syntax

2009-08-07 Thread Gabriel Genellina
because the functionality for import is bundled up with the environment.. Try the py_compile module in the standard library: http://docs.python.org/library/ The import statement does more than just checking syntax. You may want to start the interpreter with the -tt option also. -- Gabriel Genell

Re: unique-ifying a list

2009-08-07 Thread Gabriel Genellina
ipes/52560/ [3] http://groups.google.com/group/comp.lang.python/t/40c6c455f4fd5154/ -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Is "feedparser" deprecated?

2009-08-07 Thread Gabriel Genellina
lxml, specialized rss parsers like feedparser are not so much required. I've used ElementTree when I had to parse an rss feed in the past (not so many times). -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: one method of COM object needs a variant type variable

2009-08-07 Thread Gabriel Genellina
basic type. See http://msdn.microsoft.com/en-us/library/ms221627.aspx A variant can hold simple Python objects as integer, float, string... but not complex ones as, say, DocXMLRPCServer. The conversion to/from variant types is done automatically. I think you'll get more help in the python-wi...@pyt

Re: one method of COM object needs a variant type variable

2009-08-06 Thread Gabriel Genellina
variable in py?? Any compatible object may be used on the Python side, the pywin32 library manages the conversion automatically. See http://docs.activestate.com/activepython/2.4/pywin32/html/com/win32com/HTML/PythonCOM.html -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo

Re: Python configuration question when python scripts are executed using Appweb as web server.

2009-08-06 Thread Gabriel Genellina
En Thu, 06 Aug 2009 12:49:30 -0300, IronyOfLife escribió: On Aug 5, 4:18 pm, "Gabriel Genellina" wrote: En Tue, 04 Aug 2009 10:15:24 -0300, IronyOfLife escribió: > On Aug 3, 8:42 pm, "Gabriel Genellina" wrote: >> En Mon, 03 Aug 2009 11:04:07 -0300, IronyOfLi

Re: SMTP

2009-08-06 Thread Gabriel Genellina
n action: you claim to be someone at Yahoo but you're not using a Yahoo server to send mail. Try using the Yahoo smtp mail servers to deliver your message, or use your ISP address as the sender if you use their SMTP. In any case, you should log in first with the adequate username+passwor

Re: Using Python to automate builds

2009-08-06 Thread Gabriel Genellina
7;, 'COMPUTERNAME': 'LEPTON', 'HOMEDRIVE': 'D:', ... py> env['FOO']='Salta Violeta!' py> subprocess.call("echo %FOO%", shell=True, env=env) Salta Violeta! 0 -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Subclassing Python's dict

2009-08-06 Thread Gabriel Genellina
ections.UserDict on 3.x), but it's not the preferred approach to implement a new mapping class anymore. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Help making this script better

2009-08-06 Thread Gabriel Genellina
nup(logOut): [...] sys.exit(0) Exiting the script from everywhere makes it harder to reuse some of its functions later. Just return the desired status code to the caller, which in turn will return to main(), until it gets to the outermost level, which is the only place I'd use sys.exit() -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Python-URL! - weekly Python news and links (Aug 6)

2009-08-06 Thread Gabriel Genellina
QOTW: "The economy rises and falls, money comes and goes, but a great conference has permanent good effects. Well, a lot more permanent than government fiscal policy, anyway." - Python Software Foundation Director "bitter-in-victory-gracious-in-defeat-ly y'rs" timbot Is python free of "

Re: os.system in a service

2009-08-06 Thread Gabriel Genellina
En Thu, 06 Aug 2009 03:59:13 -0300, Diez B. Roggisch escribió: Gabriel Genellina schrieb: En Wed, 05 Aug 2009 13:07:39 -0300, Lawrence Wong escribió: I wrote a program which runs a .bat file using os.system like: 'os.system(pathToBatFile)' and everything was good. Then I

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-05 Thread Gabriel Genellina
ng a plain integer (sizes computed on Windows 32bits). Plus, doing bitwise operations in Python isn't a fast operation as it is in C, by example -- so your current implementation might be a quite good one (in pure Python, I mean). -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: os.system in a service

2009-08-05 Thread Gabriel Genellina
is a way to fix this or what an alternative to using os.system to run my .bat file was? Capture stdout and stderr and you'll probably see the error message: some_command >logfile.txt 2>&1 -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Two Dimensional Array + ctypes

2009-08-05 Thread Gabriel Genellina
_type = ctypes.c_float * 4096 voltages_type = arr4096_type * 4 voltages = voltages_type() The program runs but the values that come back in the array are not right. Thay might be due to the long/float confusion. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Datetime with float seconds

2009-08-05 Thread Gabriel Genellina
l32.QueryPerformanceFrequency py> plonglong = POINTER(c_longlong) py> QueryPerformanceFrequency.argtypes = [plonglong] py> freq = c_longlong() py> QueryPerformanceFrequency(byref(freq)) 1 py> freq c_longlong(3579545L) That is, on my system the resolution is 1/3579545s, or b

Re: Install setup tools for 2.6

2009-08-05 Thread Gabriel Genellina
s far away from setuptools/ez_setup as I can. I think they solve some kind of problems for some kind of people (else the tool would be defunct by now), but haven't worked for me. Perhaps you don't need setuptools either? -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Python configuration question when python scripts are executed using Appweb as web server.

2009-08-05 Thread Gabriel Genellina
En Tue, 04 Aug 2009 10:15:24 -0300, IronyOfLife escribió: On Aug 3, 8:42 pm, "Gabriel Genellina" wrote: En Mon, 03 Aug 2009 11:04:07 -0300, IronyOfLife escribió: > I have installed python 2.6.2 in windows xp professional machine. I > have set the following envir

Re: Is python buffer overflow proof?

2009-08-04 Thread Gabriel Genellina
En Tue, 04 Aug 2009 02:06:06 -0300, John Nagle escribió: Gabriel Genellina wrote: En Mon, 03 Aug 2009 18:04:53 -0300, sturlamolden escribió: On 2 Aug, 15:50, Jizzai wrote: Is a _pure_ python program buffer overflow proof? For example in C++ you can declare a char[9] to hold user input

Re: Is python buffer overflow proof?

2009-08-03 Thread Gabriel Genellina
in Java or unmanaged code in C#: all three are likely to have hidden problems. It's always the same story: a *language* may declare that such things are impossible, but a particular *implementation* may have bugs and fail to comply with the specification. -- Gabriel Genellin

Re: Ordering of dict keys & values

2009-08-03 Thread Gabriel Genellina
LUES(%s)' % ( ','.join(stats.keys()), ','.join(['?']*len(stats))) cursor.execute(query, stats.values()) [1] If you don't know what "SQL injection" means, see http://xkcd.com/327/ -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: easy_install: unresolved external symbol

2009-08-03 Thread Gabriel Genellina
En Mon, 03 Aug 2009 17:39:44 -0300, Bart Smeets escribió: I keep getting errors when trying to use easy_install to install bbfreeze or cxfreeze (same errors). This is the output: http://pastebin.com/m65ba474d Can't you use the binary packages? -- Gabriel Genellina --

Re: Python configuration question when python scripts are executed using Appweb as web server.

2009-08-03 Thread Gabriel Genellina
a CGI script; remove that. Once again, let me stress that this issue is happening only when I use appweb as the web server. I don't know appweb, but if you first make sure the script works from the command line, it should be much easier to make it work in the web server. -- G

Re: RE Question

2009-08-03 Thread Gabriel Genellina
rse HTML or XML is terribly fragile; I'd use a specific tool (like BeautifulSoup, ElementTree, or lxml) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie Question regarding __init__()

2009-07-31 Thread Gabriel Genellina
t return False, in that case init_Exec would not be executed. init_Post is always called. And that's exactly what the docstrings say. I would use an `if` statement instead: if self.init_Pre(): self.init_Exec() and make init_Exec and init_Post not return anything if they have no intrinsic meaning. And probably use better names. But basically the structure is OK. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: problem on socket programming

2009-07-31 Thread Gabriel Genellina
r the socket module contains a working example of an echo client/server program like yours: http://docs.python.org/library/socket.html#example -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: os.path.exists() and Samba shares

2009-07-31 Thread Gabriel Genellina
x27;m new to Python) SAMBA is a Linux implementation of the SMB protocol, natively supported on Windows. You may use the pywin32 package (available on sourceforge.net) to call the WNetAddConnection2 Windows function: http://msdn.microsoft.com/en-us/library/aa385413(VS.85).aspx -- Gabriel Genel

Re: Newbie Question regarding __init__()

2009-07-31 Thread Gabriel Genellina
the current instance must be qualified by self.methodname(argu, ments) -- it is not different from anotherobject.methodname(...) Every attribute that you want to access from the current instance must be qualified too: self.attributename There is no implicit self/this in Python as in other la

Re: Help understanding the decisions *behind* python?

2009-07-31 Thread Gabriel Genellina
"crippled", thinking of tuples just as immutable lists probably wasn't so natural. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: heapq "key" arguments

2009-07-31 Thread Gabriel Genellina
__lt__(self, other): return self[0](I've used an undocumented property: all heapq functions compare elements ONLY by using "<", in 2.6.2 at least. Defining all the other rich comparison methods doesn't change anything) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Bug with Python, Cygwin and /dev/urandom?

2009-07-31 Thread Gabriel Genellina
y a Python one; it might be a bug in cygwin instead. If not already reported, file a bug at http://bugs.python.org/ -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: base64 Incorrect Padding

2009-07-31 Thread Gabriel Genellina
u'll find another problem (like trying to decode the complete HTTP response instead of just the entity body, or some other stupid mistake :) ). -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: threads check socket

2009-07-31 Thread Gabriel Genellina
En Fri, 31 Jul 2009 14:42:29 -0300, NighterNet escribió: On Jul 31, 10:23 am, "Gabriel Genellina" wrote: En Fri, 31 Jul 2009 13:35:10 -0300, NighterNet escribió: > I been trying to find a way to check the socket is open or not. The > thread are in a group and loop if

Re: Use existing IE cookie

2009-07-31 Thread Gabriel Genellina
lab"' Or use ctypes to call the function of the same name in wininet.dll; see http://msdn.microsoft.com/en-us/library/aa384710(VS.85).aspx -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: class or thread id count

2009-07-31 Thread Gabriel Genellina
Person(): count = 0 def __init__(self, name, info): self.name = name self.info = info Person.count+=1 self.count = Person.count Since you menctioned "thread" in the subject, note that the above isn't thread-safe. You'll need a lock around the last t

Re: file comparison

2009-07-31 Thread Gabriel Genellina
/library/difflib.html If that's not what you want, you have to provide much more details. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: threads check socket

2009-07-31 Thread Gabriel Genellina
rom its run() method and the thread finishes execution. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Run pyc file without specifying python path ?

2009-07-30 Thread Gabriel Genellina
module and call it: #!/usr/bin/python import sys,test_pyc test_pyc.main(*sys.argv) And you *should* do it that way, instead of just importing the other module and executing ALL the program as a side-effect of the import statement. In the first case, the import lock will prevent other

Re: "Deprecated sets module" with Python 2.6

2009-07-28 Thread Gabriel Genellina
n the creation of an *.exe file that can not be executed. I don't think the warning above is related to your problem. Are you using the latest py2exe version? You may get more help in the py2exe mailing list; see http://www.py2exe.org/ -- Gabriel Genellina -- http://mail.python.o

Re: bad certificate error

2009-07-28 Thread Gabriel Genellina
En Tue, 28 Jul 2009 09:02:40 -0300, Steven D'Aprano escribió: On Mon, 27 Jul 2009 23:16:39 -0300, Gabriel Genellina wrote: I don't see the point on "fixing" either the Python script or httplib to accomodate for an invalid server certificate... If it's just for inter

Python-URL! - weekly Python news and links (Jul 28)

2009-07-28 Thread Gabriel Genellina
QOTW: "But there's another principle at work here that's less well known, and that was first articulated to me by Robert Dewar: You can remove linear factors by profiling, but it's much harder to undo bad algorithmic decisions. In particular, whether a program runs in O(n) or O(n^2) sometimes dep

Re: ioctl on socket

2009-07-28 Thread Gabriel Genellina
En Tue, 28 Jul 2009 07:05:43 -0300, jacopo mondi escribió: Gabriel Genellina wrote: En Mon, 27 Jul 2009 16:35:51 -0300, jacopo mondi escribió: Is there a reason why there is no ioctl interface for socket either then for windows platform? It's technical issues or what else?? I

Re: Determining __name__ from the code that called a function

2009-07-28 Thread Gabriel Genellina
7;__name__'] but I don't know how portable is that across Python implementations. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: exceptions.TypeError an integer is required

2009-07-27 Thread Gabriel Genellina
tructor, and it returns a new object (an integer) based upon its argument. (so it's quite different from, say, casting "short" to "unsigned short" in C, that only changes the way the compiler treats the same bytes in memory). -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: What is file.encoding convention?

2009-07-27 Thread Gabriel Genellina
he documentation, at least in Python 2.x). See http://bugs.python.org/issue4947 -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get the output struct parameter by extending C function?

2009-07-27 Thread Gabriel Genellina
ypes. Don't mix both ways. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: bad certificate error

2009-07-27 Thread Gabriel Genellina
En Mon, 27 Jul 2009 20:00:27 -0300, Steven D'Aprano escribió: On Mon, 27 Jul 2009 15:23:41 -0300, Gabriel Genellina wrote: En Mon, 27 Jul 2009 12:57:40 -0300, jakecjacobson escribió: I was wondering if this is due to the server having a invalid server cert? If I go to this server

Re: ioctl on socket

2009-07-27 Thread Gabriel Genellina
ckets, and DeviceIoControl (from the pywin32 package) with other files. On Linux, you have fcntl.ioctl that works with any kind of file. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: where do I put resources (images, audio files) when I wrote Python program?

2009-07-27 Thread Gabriel Genellina
s a binary string that is the contents of the specified resource. For packages located in the filesystem, which have already been imported, this is the rough equivalent of: d = os.path.dirname(sys.modules[package].__file__) data = open(os.path.join(d, resource), 'rb').read() return da

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