[pygtk] ANNOUNCE: PyGObject 2.15.0

2008-07-15 Thread Johan Dahlin
I am pleased to announce version 2.15.0 of the Python bindings for GObject. The new release is available from ftp.gnome.org as and its mirrors as soon as its synced correctly: http://download.gnome.org/sources/pygobject/2.15/ There are two new significant features in this release, initial

Re: Python pack and unpack question

2008-07-15 Thread Mark Tolonen
joe shoemaker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] If you have the following: data = unpack('L', sock.recv(4)) Does this line of code means that incoming data is big endian and unpack it to endianess of local machine? If local machine is little endian, then big

Re: new itertools functions in Python 2.6

2008-07-15 Thread Raymond Hettinger
On Jul 14, 1:26 pm, Mensanator [EMAIL PROTECTED] wrote: ##  Combinations with replacement ##  - ##  aaa aab aac aad aae abb abc abd abe acc acd ace ##  add ade aee bbb bbc bbd bbe bcc bcd bce bdd bde ##  bee ccc ccd cce cdd cde cee ddd dde dee eee ## ##  actual

Re: Unicode confusion

2008-07-15 Thread Mark Tolonen
Jerry Hill [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Mon, Jul 14, 2008 at 12:40 PM, Tim Cook [EMAIL PROTECTED] wrote: if I say units=unicode(°). I get UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 0: ordinal not in range(128) If I try

Re: python mysteriously halts

2008-07-15 Thread Gabriel Genellina
En Mon, 07 Jul 2008 12:26:28 -0300, Todd [EMAIL PROTECTED] escribió: On Jul 7, 10:17 am, Tim Golden [EMAIL PROTECTED] wrote: Todd wrote: I ran a python script last night which connects to a matlab automation server via DCOM (using win32com).  I expected to see the results when I came in

Re: trying to use sax for a very basic first xml parser

2008-07-15 Thread manu
May I suggest you ask in the blender list? Will do that and report back. Thank you! Manuel -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is there no GUI-tools like this for Windows?

2008-07-15 Thread Michael Torrie
Marcus.CM wrote: So python for me is for anything except GUI. It becomes self rejecting notion to do GUI in python when you type in those stuff that could have been handled by an IDE, thus for linux project i just do the web interface + php and let python do all the other hard core work.

Re: screencapture with PIL question

2008-07-15 Thread Gabriel Genellina
En Mon, 14 Jul 2008 12:11:55 -0300, greg [EMAIL PROTECTED] escribi�: I am able to use the PIL module to capture a screen or specific window. My problem is when capturing a window (on windows XP) I can only capture the visible portion of the window. Is there any way to capture the entire

Re: Python Tiddlywiki class

2008-07-15 Thread CracKPod
On 15 Jul., 03:04, David [EMAIL PROTECTED] wrote: CracKPod wrote: Hello, I wrote a Python class to interact with the TiddlyWiki. In case you are interested you can find it on my blog: http://crackpod.bplaced.net/ CracKPod -- http://mail.python.org/mailman/listinfo/python-list Thank

Re: iterator clone

2008-07-15 Thread Kay Schluehr
On 15 Jul., 08:16, Yosifov Pavel [EMAIL PROTECTED] wrote: cloning of iterators in this manner is bad, more good is to use one, single list(my_iter) instead of (seehttp://aquagnu.blogspot.com/2008/07/self-repair-iterator-in-python.html). This won't work for big iterators as mentioned by Peter

Re: Using Python To Launch Python

2008-07-15 Thread Gabriel Genellina
En Mon, 14 Jul 2008 21:39:20 -0300, Derek Martin [EMAIL PROTECTED] escribió: On Mon, Jul 14, 2008 at 05:40:43PM -0400, Aquil H. Abdullah wrote: You've hit the proverbial nail with the hammer. The problem is that my application needs to run under both the Linux and Windows OSs, so while I

Testing for Internet Connection

2008-07-15 Thread Alexnb
Hello internet. I am wondering, is there a simple way to test for Internet connection? If not, what is the hard way :p -- View this message in context: http://www.nabble.com/Testing-for-Internet-Connection-tp18460572p18460572.html Sent from the Python - python-list mailing list archive at

Re: Testing for Internet Connection

2008-07-15 Thread Alex Marandon
Alexnb wrote: I am wondering, is there a simple way to test for Internet connection? If not, what is the hard way :p Trying to fetch the homepage from a few major websites (Yahoo, Google, etc.)? If all of them are failing, it's very likely that the connection is down. You can use urllib2 [1]

Re: FOSS projects exhibiting clean/good OOP?

2008-07-15 Thread paul
Phillip B Oldham schrieb: Thanks all - lots to go through there! :D I'd heard previously that Trac was a nice example, or rather its core was, but I'd also heard that there were lots of problems with it and that they were redeveloping it from scratch? They continually improve parts of it, but I

Python embedding question.

2008-07-15 Thread Thomas Troeger
Hi, Sorry I've posted a similar question some weeks ago, but I got no answers. I want to embed a Python application on a device with limited resources, esp. storage limitations. Is there a way to reduce the Python interpreter to a set of modules that's urgently needed? Or is there a method

Re: Python embedding question.

2008-07-15 Thread Kay Schluehr
On 15 Jul., 11:51, Thomas Troeger [EMAIL PROTECTED] wrote: I've really looked at a lot of places but haven't found a suitable solutions yet, so I'm asking here in hope that someone has experience with that topic. Which solutions did you rule out? --

Re: Python embedding question.

2008-07-15 Thread Uwe Schmitt
On 15 Jul., 12:14, Thomas Troeger [EMAIL PROTECTED] wrote: Kay Schluehr wrote: On 15 Jul., 11:51, Thomas Troeger [EMAIL PROTECTED] wrote: I've really looked at a lot of places but haven't found a suitable solutions yet, so I'm asking here in hope that someone has experience with that

Re: Testing for Internet Connection

2008-07-15 Thread Ben Finney
Alexnb [EMAIL PROTECTED] writes: I am wondering, is there a simple way to test for Internet connection? If not, what is the hard way :p Refine the question: What do you mean by internet? It isn't a single entity. Do you mean some particular internet host responding on a particular network

Re: screencapture with PIL question

2008-07-15 Thread Fredrik Lundh
greg wrote: I am able to use the PIL module to capture a screen or specific window. My problem is when capturing a window (on windows XP) I can only capture the visible portion of the window. Is there any way to capture the entire window? specifically the scrolled portion of a window that is

Re: Testing for Internet Connection

2008-07-15 Thread Thomas Troeger
Alex Marandon wrote: Alexnb wrote: I am wondering, is there a simple way to test for Internet connection? If not, what is the hard way :p Trying to fetch the homepage from a few major websites (Yahoo, Google, etc.)? If all of them are failing, it's very likely that the connection is down.

Re: SAX XML Parse Python error message

2008-07-15 Thread Fredrik Lundh
goldtech wrote: I would be grateful for support with the code I cited. It's not long and fairly standard. I'm sure my error(s) would be glaring to more experienced coders. I appreciated the heads-up about other options but I would be grateful for help getting this code to run. Thanks For

Re: why is self used in OO-Python?

2008-07-15 Thread Fredrik Lundh
ssecorp wrote: def append(self, item): self.stack.append(item) I can get to see the stack with var.stack but then why even implement append when I could do self.stack.append(x) etc. That way you could do away with OO completely. Umm. Even if you were to write that, self and

Re: Testing for Internet Connection

2008-07-15 Thread Marc Christiansen
Alex Marandon [EMAIL PROTECTED] wrote: Alexnb wrote: I am wondering, is there a simple way to test for Internet connection? If not, what is the hard way :p Trying to fetch the homepage from a few major websites (Yahoo, Google, etc.)? If all of them are failing, it's very likely that the

Logging in __del__()

2008-07-15 Thread Robert Rawlins
Guys, I'm trying to help trace when instances of particular classes are being destroyed by the garbage collector and thought the cleanest way would be to implement a logging call in __del__() on the class. However, I'm having an issue. I inject a logger instance into my class upon

How can I save command prompt screen

2008-07-15 Thread Ty hensons
how can i save my command prompt screen? -- http://mail.python.org/mailman/listinfo/python-list

Re: Logging in __del__()

2008-07-15 Thread Fredrik Lundh
Robert Rawlins wrote: I then get the following exception thrown when running my code: When the application is running, or when it is shutting down? Traceback (most recent call last): File /usr/lib/python2.5/logging/handlers.py, line 73, in emit if self.shouldRollover(record): File

Re: Python embedding question.

2008-07-15 Thread David Lyon
Thomas Troeger wrote: I want to embed a Python application on a device with limited resources, esp. storage limitations. Is there a way to reduce the Python interpreter to a set of modules that's urgently needed? Of course there is. What is the target platform ? What can be done is to go

Suggestion: Python global scope

2008-07-15 Thread Anonymous Bastard
I've been tossing this idea in my mind for some time now: In Python, declaring a variable using the global statement automatically makes it available in all subsequent scopes. But to me, it makes more sense to use the global statement to 'import' a variable from the global scope into the

Re: Suggestion: Python global scope

2008-07-15 Thread Gerhard Häring
Anonymous Bastard wrote: I've been tossing this idea in my mind for some time now: In Python, declaring a variable using the global statement automatically makes it available in all subsequent scopes. But to me, it makes more sense to use the global statement to 'import' a variable from the

Logging to different addressees

2008-07-15 Thread McA
Hi all, I need a recommendation. I would to like to use the logging module to create log messages the following way: a) Every log message does go to a admin sink. b) The logging of special messages should go to the admin sink AND to a sink specifically for a certain addressee. c) I don't want to

Simplify Code

2008-07-15 Thread Victor Subervi
Hi; Forgive multiple posts in one day: online very infrequently I set the following variables: # Headers are kept in order to determine nesting of chapters # They are labeled according to font size h36 = '' h26 = '' h22 = '' h18 = '' h14 = '' h12 = '' header_sizes = [36, 26, 22, 18, 14, 12] # Size

Type Problem

2008-07-15 Thread Victor Subervi
Hi; Forgive multiple posts in one day: online very infrequently Why am I getting this error? import os dir_dict = {6:36, 5:26, 4:22, 3:18, 2:14, 1:12} cur_dir = os.getcwd() dirs = os.path.split(cur_dir) len = len(dirs) type(len(dirs)) Traceback (most recent call last): File pyshell#11, line 1,

Characters Being Misread

2008-07-15 Thread Victor Subervi
Hi; Forgive multiple posts in one day: online very infrequently I'm having the darndest time trying to figure out how the character '\b0' is being read in ('\x0c') test = re.search('(?=\\b)[0]', '\x0c0') test.group(0) '0' type('\x0c') type 'str' import binascii binascii.unhexlify('\x0c')

Re: Using McMillan Installer, PyInstall or py2exe cross-platform?

2008-07-15 Thread David Lyon
Hi Hartmut, I can sympathise with you on this one... There are a few options... there is a python based bake make like program... that is useful... http://projects.bertram-scharpf.de/bake/bake1.html then there is Wine... that is a windows emulator under linux... that might be pretty

Re: Suggestion: Python global scope

2008-07-15 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 The function of the global keyword is to 'push' local variables to the global scope. If you want to 'import' a variable into a local scope, pass the variable to your function/method as an argument. Anonymous Bastard wrote: I've been tossing this

AW: Python embedding question.

2008-07-15 Thread Troeger, Thomas (ext)
Hi, I want to embed a Python application on a device with limited resources, esp. storage limitations. Is there a way to reduce the Python interpreter to a set of modules that's urgently needed? Of course there is. What is the target platform ? Thanks for your answer. The plattform is

Re: Suggestion: Python global scope

2008-07-15 Thread John Roth
On Jul 15, 5:57 am, Anonymous Bastard [EMAIL PROTECTED] wrote: I've been tossing this idea in my mind for some time now: In Python, declaring a variable using the global statement automatically makes it available in all subsequent scopes. But to me, it makes more sense to use the global

[ANN} Daily pyogp coders meeting (PYthon Open Grid Protocols for virtual worlds)

2008-07-15 Thread Lawson English
pyogp is a Python-based virtual worlds test harness and client library being developed by Linden Lab, makers of Second Life, and members of the SL Architecture Working Group, in order to test the Open Grid Protocols that were used in the recent proof of concept demo by IBM and Linden Lab, that

Re: Python embedding question.

2008-07-15 Thread Jerry Hill
On Tue, Jul 15, 2008 at 5:51 AM, Thomas Troeger [EMAIL PROTECTED] wrote: Or is there a method to have gzipped modules that are unzipped on the fly into memory when they're accessed? That would be even better. Yes. See the documentation for the zipimport module, and PEP 273.

Re: AW: Python embedding question.

2008-07-15 Thread David Lyon
Troeger, Thomas (ext) wrote: Thanks for your answer. The plattform is x86, so basically it's a PC with a compact flash drive. The problem is that the compact flash is rather limited in speed and size (there is other stuff on it too). Oh ok. Well just keep in mind that 4GB of flash memory can

Re: Why is there no GUI-tools like this for Windows?

2008-07-15 Thread Cromulent
On 2008-07-12 22:35:58 +0100, maestro [EMAIL PROTECTED] said: http://www.youtube.com/watch?v=PXpwC1o5AcI I have done some GUI-programming for windows with Python but the Tkinter interface sucked and while it is the only one I tried I got the impression they are all the same. It's amazing how

Re: Python embedding question.

2008-07-15 Thread Stephen Johnson
The Pyglet library has all the functionality of pygame, but is smaller and much more self-contained. Pygame requires SDL, pyglet only OpenGL. On Jul 15, 2008, at 6:26 AM, Uwe Schmitt wrote: On 15 Jul., 12:14, Thomas Troeger [EMAIL PROTECTED] wrote: Kay Schluehr wrote: On 15 Jul., 11:51,

Re: logging via SocketHandler and TCPserver

2008-07-15 Thread Vinay Sajip
On Jul 14, 11:16 pm, Larry Bates [EMAIL PROTECTED] wrote: Vinay, Thanks for your detailed explanation, but IMHO your suggested solution is almost the opposite (right idea wrong direction) of what I'm looking for. Hypothetical setup: application1 - SocketHandlerloggingturned on

Python internals

2008-07-15 Thread Peter Anderson
Hi! I am slowly teaching myself Python. I was reading David Beazley's excellent book Python - Essential Reference; in particular about variables. Let me quote: Python is a dynamically typed language in which names can represent values of different types during the execution of a program.

Re: Logging to different addressees

2008-07-15 Thread Vinay Sajip
On Jul 15, 1:27 pm, McA [EMAIL PROTECTED] wrote: Hi all, I need a recommendation. I would to like to use theloggingmodule to create log messages the following way: a) Every log message does go to a admin sink. b) Theloggingof special messages should go to the admin sink AND to a sink

Re: Method behavior for user-created class instances

2008-07-15 Thread [EMAIL PROTECTED]
On 15 juil, 01:24, [EMAIL PROTECTED] wrote: Greetings. I am looking for a way to achieve method behavior for a class I created. That is, it has a __call__ method, so can be called like a function. But I also want it to be treated as a method when it appears in a class body. You need to

Python internals question

2008-07-15 Thread Peter Anderson
Hi! I am slowly teaching myself Python. I was reading David Beazley's excellent book Python - Essential Reference; in particular about variables. Let me quote: Python is a dynamically typed language in which names can represent values of different types during the execution of a program. In

Re: Logging in __del__()

2008-07-15 Thread Vinay Sajip
On Jul 15, 1:51 pm, Robert Rawlins [EMAIL PROTECTED] wrote: Am I right in thinking that Python destroys instances of classes when it deems they are no longer needed? I shouldn't have to explicitly delete the classes, right? Python uses reference counting with a cycle detector, but the

Modify a string's value

2008-07-15 Thread s0suk3
Hi everyone, I've heard that a 'str' object is immutable. But is there *any* way to modify a string's internal value? Thanks, Sebastian -- http://mail.python.org/mailman/listinfo/python-list

Re: Simplify Code

2008-07-15 Thread Michiel Overtoom
Victor wrote... # del is used to determine if should reset the lower header values to '' del = 0 Apart from many other things that spring to mind, I already see an obvious flaw: 'del' is a keyword, or a 'reserved word' in Python. It is used to remove variables from the namespace. Tip: Use some

Re: How to package a logging.config file?

2008-07-15 Thread Matthew Wilson
On Mon 14 Jul 2008 09:25:19 AM EDT, Vinay Sajip wrote: Is your package a library or an application? If it's a library, you should avoid configuring logging using a config file - this is because logging configuration is process-wide, and if multiple libraries use fileConfig to configure their

Re: Type Problem

2008-07-15 Thread Michiel Overtoom
Victor wrote... len = len(dirs) The function 'len' is a built-in function in Python. If you assign an integer to the name 'len', that will replace the function with an int. And you can't call an int. My suggestion: Do not use 'len' as a variable name. Use something else, like:

Re: Modify a string's value

2008-07-15 Thread Ben Finney
[EMAIL PROTECTED] writes: I've heard that a 'str' object is immutable. But is there *any* way to modify a string's internal value? If there were, it would not be immutable. The 'str' type has only immutable values. You could implement your own string type, and have it allow mutable values.

Re: Characters Being Misread

2008-07-15 Thread Michiel Overtoom
Victor wrote... import binascii binascii.unhexlify('\x0c') TypeError: Odd-length string What gives here? The function unhexlify() wants an even-length string. From the online help: help(binascii.unhexlify) unhexlify(...) a2b_hex(hexstr) - s; Binary data of hexadecimal representation.

Re: Anyone happen to have optimization hints for this loop?

2008-07-15 Thread dp_pearce
Thank you so much for all your advice. I have learnt a lot. In the end, the solution was perhaps self evident. Why try and build a huge string AND THEN write it to file when you can just write it to file? Writing this much data directly to file completed in ~1.5 seconds instead of the 3-4 seconds

Re: Modify a string's value

2008-07-15 Thread bearophileHUGS
Sebastian: I've heard that a 'str' object is immutable. But is there *any* way to modify a string's internal value? No, but you can use other kind of things: s = hello sl = list(s) sl[1] = a sl ['h', 'a', 'l', 'l', 'o'] .join(sl) 'hallo' from array import array sa = array(c, s) sa

fork after creating temporary file using NamedTemporaryFile

2008-07-15 Thread rparimi
Hello pythoners, When I create temporary file using the tempfile module, and forkI) later on in my program, I always see errors when the program exits. Is this because the child process deletes temp file? Here's a stripped down version of my script that exhibits this problem: #!/usr/bin/python

Re: logging via SocketHandler and TCPserver

2008-07-15 Thread Larry Bates
Vinay Sajip wrote: On Jul 14, 11:16 pm, Larry Bates [EMAIL PROTECTED] wrote: Vinay, Thanks for your detailed explanation, but IMHO your suggested solution is almost the opposite (right idea wrong direction) of what I'm looking for. Hypothetical setup: application1 -

Is it legal to rebuild Python.exe to include Version property tab?

2008-07-15 Thread ward . david
My company distributes a COM object that can be license and userd by our customers. Some of my company's internal application also use the COM object. However, for internal applications, instead of licensing the COM object, we just make the application registered as friendly. We accomplish this be

Re: One step up from str.split()

2008-07-15 Thread Sion Arrowsmith
Joel Koltner [EMAIL PROTECTED] wrote: I normally use str.split() for simple splitting of command line arguments, but I would like to support, e.g., long file names which-- under windows -- are typically provided as simple quoted string. E.g., myapp --dosomething --loadthis my file name.fil

Re: Python internals

2008-07-15 Thread Larry Bates
Peter Anderson wrote: Hi! I am slowly teaching myself Python. I was reading David Beazley's excellent book Python - Essential Reference; in particular about variables. Let me quote: Python is a dynamically typed language in which names can represent values of different types during the

Re: Using Python To Launch Python

2008-07-15 Thread Aquil H. Abdullah
Ack, .bat files! Yes, you are correct Windows does not ship with Python, and there are ways to get bash (cygwin) on your Windoze system. I am leaning towards a solution similar to your second suggestion as it will keep me from having to distribute .bat files for one platform and .sh files for

Re: Using Python To Launch Python

2008-07-15 Thread Aquil H. Abdullah
Ahh, Win-BASH cool!!! On Tue, Jul 15, 2008 at 10:41 AM, Aquil H. Abdullah [EMAIL PROTECTED] wrote: Ack, .bat files! Yes, you are correct Windows does not ship with Python, and there are ways to get bash (cygwin) on your Windoze system. I am leaning towards a solution similar to your second

Re: Suggestion: Python global scope

2008-07-15 Thread André
On Jul 15, 10:13 am, Nick Dumas [EMAIL PROTECTED] wrote: The function of the global keyword is to 'push' local variables to the global scope. If you want to 'import' a variable into a local scope, pass the variable to your function/method as an argument. Anonymous Bastard wrote: I've been

Re: Is it legal to rebuild Python.exe to include Version property tab?

2008-07-15 Thread Michiel Overtoom
Ward wrote... Can we rebuild Python.exe to include the various version information? Why rebuild it? You can use a resource editor tool to add/edit/delete the VERSIONINFO from any Windows executable, including Python.exe ;-) Greetings, -- The ability of the OSS process to collect and

MySQL Insert

2008-07-15 Thread maestroQC
Hi, Its one of those days. I cannot solve this. Any help would be greatly appreciated! When I execute this: class Db(object): def insertAccount(self, date, accountNumber, description, openingBalance): dec = decimal.Decimal(openingBalance) db = MySQLdb.connect(host=localhost,

String flags - redundant?

2008-07-15 Thread Alexandru Palade
Hi to everyone, I'm rather a Python newbie, so I've put myself a question. Are these two statements (performance-wise) equal? r Text and Text I mean using the raw flag speeds up things because the interpreter doesn't need to look after escape sequences? Or it's rather optimized? I'm

Zipping files

2008-07-15 Thread dp_pearce
Hi all, I have come across an error while using zipfile and I can't seem to find somewhere that explains the problem. My script needs to be able to take text files from one drive and add them to zip files on another drive. The following seems to work just fine. import zipfile # write test file

installation error on linux 64

2008-07-15 Thread Marc-André Belzile
Hi, I've compiled python 2.5.2 on red hat r4 and got this installation error: mtl-p1892:[Python-2.5.2] 1make install ... Compiling /BuildViews/python252build/Python2.5.2.bin/lib/python2.5/test/test_module.py ...

Invoking non-static methods of a non-Python object instance

2008-07-15 Thread Dobedani
Dear All, For some time now, I have been working with the ctypes module on Windows. First I got my hands on a library developed with Delphi 7. That library is exporting plain functions. Internally, reference is made to the instance of a class, which is instantiated in a kind of initialization

Re: Testing for Internet Connection

2008-07-15 Thread Alexnb
Ben Finney-2 wrote: Alexnb [EMAIL PROTECTED] writes: I am wondering, is there a simple way to test for Internet connection? If not, what is the hard way :p Refine the question: What do you mean by internet? It isn't a single entity. Do you mean some particular internet host

Re: Is it legal to rebuild Python.exe to include Version property tab?

2008-07-15 Thread ward . david
On Jul 15, 7:42 am, Michiel Overtoom [EMAIL PROTECTED] wrote: Why rebuild it? You can use a resource editor tool to add/edit/delete the VERSIONINFO from any Windows executable, including Python.exe ;-) M, Thanks for you suggestion. I didn't know that there was anything like a resource editor

Re: Python internals question

2008-07-15 Thread Helmut Jarausch
Peter Anderson wrote: Hi! I am slowly teaching myself Python. I was reading David Beazley's excellent book Python - Essential Reference; in particular about variables. Let me quote: Python is a dynamically typed language in which names can represent values of different types during the

Re: String flags - redundant?

2008-07-15 Thread Marc 'BlackJack' Rintsch
On Tue, 15 Jul 2008 18:14:15 +0300, Alexandru Palade wrote: I'm rather a Python newbie, so I've put myself a question. Are these two statements (performance-wise) equal? r Text and Text I mean using the raw flag speeds up things because the interpreter doesn't need to look after

Re: Python internals question

2008-07-15 Thread Marc 'BlackJack' Rintsch
On Tue, 15 Jul 2008 23:54:46 +1000, Peter Anderson wrote: Python is a dynamically typed language in which names can represent values of different types during the execution of a program. In fact the names used in the program are really just labels for various quantities and objects. The

Re: Testing for Internet Connection

2008-07-15 Thread Grant Edwards
If you can define exactly what you mean by internet connection, the test for it becomes correspondingly easier. Well, really I just need to figure out if I am able to connect to one site. That site is dictionary.com. Then use urllib2 to try to fetch a page from dictionary.com. If it works,

Re: Testing for Internet Connection

2008-07-15 Thread Alexnb
Troeger Thomas (Ext) wrote: Alex Marandon wrote: Alexnb wrote: I am wondering, is there a simple way to test for Internet connection? If not, what is the hard way :p Trying to fetch the homepage from a few major websites (Yahoo, Google, etc.)? If all of them are failing, it's very

Re: Is it legal to rebuild Python.exe to include Version property tab?

2008-07-15 Thread Victor Noagbodji
I think it is. I got a bundle of Python named EnthoughtPython and the version string gave something different from original Python. -- NOAGBODJI Paul Victor -- http://mail.python.org/mailman/listinfo/python-list

Re: Zipping files

2008-07-15 Thread Tim Golden
dp_pearce wrote: Hi all, I have come across an error while using zipfile and I can't seem to find somewhere that explains the problem. My script needs to be able to take text files from one drive and add them to zip files on another drive. The following seems to work just fine. import zipfile

Re: How can I save command prompt screen

2008-07-15 Thread Tim Golden
Ty hensons wrote: how can i save my command prompt screen? (Trying to be helpful here...) What do mean by save and what do you mean by command prompt screen? And, especially, what platform are you running on? TJG -- http://mail.python.org/mailman/listinfo/python-list

Re: About wmi

2008-07-15 Thread Tim Golden
patrol wrote: Situation (2): result = new_process.terminate() File C:\Python25\lib\wmi.py, line 494, in __getattr__ handle_com_error (error_info) File C:\Python25\lib\wmi.py, line 190, in handle_com_error raise x_wmi, \n.join (exception_string) UnicodeDecodeError: 'ascii' codec

Re: Logging to different addressees

2008-07-15 Thread McA
Hi Vinary, thank you for answering. I start be proud that the author of the logging package himself is answering. :-) On 15 Jul., 15:51, Vinay Sajip [EMAIL PROTECTED] wrote: On Jul 15, 1:27 pm, McA [EMAIL PROTECTED] wrote: Add a handler to the root logger (or common_logger) to send to the

Re: Method behavior for user-created class instances

2008-07-15 Thread crazychimp132
On Jul 15, 9:53 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On 15 juil, 01:24, [EMAIL PROTECTED] wrote: Greetings. I am looking for a way to achieve method behavior for a class I created. That is, it has a __call__ method, so can be called like a function. But I also want it to be

Re: About wmi

2008-07-15 Thread Tim Golden
patrol wrote: Situation (1): result = new_process.terminate() TypeError: 'int' object is not callable I'm not sure exactly what's causing that particular effect, but I would suggest that you call the method as .Terminate (note the initial capital). On my box, calling .terminate simply

isPrime works but UnBoundLocalError when mapping on list

2008-07-15 Thread defn noob
isPrime works when just calling a nbr but not when iterating on a list, why? adding x=1 makes it work though but why do I have to add it? Is there a cleaner way to do it? def isPrime(nbr): for x in range(2, nbr + 1): if nbr % x == 0: break if x == nbr: return

Re: Zipping files

2008-07-15 Thread dp_pearce
When I saw Permission denied, this was my suspicion. And I think you are very right. I have just gone back and tried writing to a file outside of C:, in this case C:/output/, and it seems to work again. Would I be right in guessing there is no way around this? Dan --

Re: Zipping files

2008-07-15 Thread Tim Golden
dp_pearce wrote: When I saw Permission denied, this was my suspicion. And I think you are very right. I have just gone back and tried writing to a file outside of C:, in this case C:/output/, and it seems to work again. Would I be right in guessing there is no way around this? Well, you could

Re: Suggestion: Python global scope

2008-07-15 Thread Carl Banks
On Jul 15, 7:57 am, Anonymous Bastard [EMAIL PROTECTED] wrote: I've been tossing this idea in my mind for some time now: In Python, declaring a variable using the global statement automatically makes it available in all subsequent scopes. But to me, it makes more sense to use the global

need ldap windows binary and/or installation help

2008-07-15 Thread Sells, Fred
I'm running python 2.5 (or 2.4) in an XP environment. I downloaded and installed the .dll's from OpenLDAP-2.4.8+OpenSSL-0.9.8g-Win32.zip and copied the .dll's in c:/windows/system32 as instructed now I get this error. Is there anyway to avoid building the python_ldap binaries? Apart from

Re: isPrime works but UnBoundLocalError when mapping on list

2008-07-15 Thread norseman
defn noob wrote: isPrime works when just calling a nbr but not when iterating on a list, why? adding x=1 makes it work though but why do I have to add it? Is there a cleaner way to do it? def isPrime(nbr): for x in range(2, nbr + 1): if nbr % x == 0: break if x ==

Measure class, precision, significant digits, and divmod()

2008-07-15 Thread Ethan Furman
Hey all. My thanks to all who have responded so far with my other questions. It is much appreciated. Some background on what I'm doing (a good explanation can be found at http://www.hazelwood.k12.mo.us/~grichert/sciweb/phys8.htm): When measuring, there is some uncertainty as to the

Re: need ldap windows binary and/or installation help

2008-07-15 Thread Tim Golden
Sells, Fred wrote: I'm running python 2.5 (or 2.4) in an XP environment. I downloaded and installed the .dll's from OpenLDAP-2.4.8+OpenSSL-0.9.8g-Win32.zip and copied the .dll's in c:/windows/system32 as instructed now I get this error. Is there anyway to avoid building the python_ldap

Re: fork after creating temporary file using NamedTemporaryFile

2008-07-15 Thread Sebastian lunar Wiesner
[EMAIL PROTECTED] [EMAIL PROTECTED]: When I create temporary file using the tempfile module, and forkI) later on in my program, I always see errors when the program exits. Is this because the child process deletes temp file? Here's a stripped down version of my script that exhibits this

File Locking Forced? Newbie question.

2008-07-15 Thread Sparky
Hello! I am writing some software that will have many users accessing the same file resource at once for reading purposes only. I am programming on (Ubuntu) Linux and my question is in Windows, can I have it so that the same file can be open in read mode by more than one person or could Window's

RE: isPrime works but UnBoundLocalError when mapping on list

2008-07-15 Thread Andreas Tawn
defn noob wrote: isPrime works when just calling a nbr but not when iterating on a list, why? adding x=1 makes it work though but why do I have to add it? Is there a cleaner way to do it? def isPrime(nbr): for x in range(2, nbr + 1): if nbr % x == 0: break

Re: isPrime works but UnBoundLocalError when mapping on list

2008-07-15 Thread Mensanator
On Jul 15, 11:26 am, defn noob [EMAIL PROTECTED] wrote: isPrime works when just calling a nbr but not when iterating on a list, why? adding x=1 makes it work though but why do I have to add it? Is there a cleaner way to do it? def isPrime(nbr):     for x in range(2, nbr + 1):         if

Re: MySQL Insert

2008-07-15 Thread Carsten Haese
maestroQC wrote: cursor.execute(INSERT INTO es_accounts (dateCreated, accountNumber, description, openingBalance) VALUES (%s, %s, %s , %d), (date, accountNumber, description, dec)) File c:\python25\lib\site-packages\MySQLdb\cursors.py, line 151, in execute query = query %

Re: File Locking Forced? Newbie question.

2008-07-15 Thread Tim Golden
Sparky wrote: Hello! I am writing some software that will have many users accessing the same file resource at once for reading purposes only. I am programming on (Ubuntu) Linux and my question is in Windows, can I have it so that the same file can be open in read mode by more than one person or

Re: isPrime works but UnBoundLocalError when mapping on list

2008-07-15 Thread defn noob
On Jul 15, 7:28 pm, Mensanator [EMAIL PROTECTED] wrote: On Jul 15, 11:26 am, defn noob [EMAIL PROTECTED] wrote: isPrime works when just calling a nbr but not when iterating on a list, why? adding x=1 makes it work though but why do I have to add it? Is there a cleaner way to do it?

Re: isPrime works but UnBoundLocalError when mapping on list

2008-07-15 Thread Mensanator
On Jul 15, 12:28 pm, Andreas Tawn [EMAIL PROTECTED] wrote: defn noob wrote: isPrime works when just calling a nbr but not when iterating on a list, why? adding x=1 makes it work though but why do I have to add it? Is there a cleaner way to do it? def isPrime(nbr):     for x in

  1   2   3   >