Re: Problem with lower() for unicode strings in russian
On Oct 6, 8:39 am, Alexey Moskvin <[EMAIL PROTECTED]> wrote: > Martin, thanks for fast reply, now anything is ok! > On Oct 6, 1:30 am, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > > > I have a set of strings (all letters are capitalized) at utf-8, > > > That's the problem. If these are really utf-8 encoded byte strings, > > then .lower likely won't work. It uses the C library's tolower API, > > which works on a byte level, i.e. can't work for multi-byte encodings. > > > What you need to do is to operate on Unicode strings. I.e. instead > > of > > > s.lower() > > > do > > > s.decode("utf-8").lower() > > > or (if you need byte strings back) > > > s.decode("utf-8").lower().encode("utf-8") > > > If you find that you write the latter, I recommend that you redesign > > your application. Don't use byte strings to represent text, but use > > Unicode strings all the time, except at the system boundary (where > > you decode/encode as appropriate). > > > There are some limitations with Unicode .lower also, but I don't > > think they apply to Russian (specifically, SpecialCasing.txt is > > not considered). > > > HTH, > > Martin Alexey, if your strings stored in some text file you can use "codecs" package > import codecs > handler = codecs.open('somefile', 'r', 'utf-8') > # ... do the job > handler.close() I prefer this way to deal with russian in utf-8. Konstantin. -- http://mail.python.org/mailman/listinfo/python-list
urllib2 - safe way to download something
Hi, I wonder if there is a safe way to download page with urllib2. I've constructed following method to catch all possible exceptions. def retrieve(url): user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)' headers = {'User-Agent':user_agent} request = urllib2.Request(url, headers=headers) try: handler = urllib2.urlopen(request) data = handler.read() handler.close() except urllib2.HTTPError, e: log.warning("Server couldn't fulfill the request: %s, %s" % \ (url, e.code)) return None except urllib2.URLError, e: log.warning("Failed to reach a server: %s, %s" % (url, e.reason)) return None except HTTPException, e: log.warning("HTTP exception: %s, %s" % (url, e.__class__.__name__)) return None except socket.timeout: log.warning("Timeout expired: %s" % (url)) return None return data But suddenly I've got the following: Traceback (most recent call last): File "/usr/lib/python2.5/threading.py", line 486, in __bootstrap_inner self.run() File "/home/light/prj/ym-crawl/shops/dispatcher.py", line 122, in run self.task(self.queue, item) File "scrawler.py", line 24, in spider data = retrieve(url) File "scrawler.py", line 44, in retrieve data = handler.read() File "/usr/lib/python2.5/socket.py", line 291, in read data = self._sock.recv(recv_size) File "/usr/lib/python2.5/httplib.py", line 509, in read return self._read_chunked(amt) File "/usr/lib/python2.5/httplib.py", line 563, in _read_chunked value += self._safe_read(chunk_left) File "/usr/lib/python2.5/httplib.py", line 602, in _safe_read chunk = self.fp.read(min(amt, MAXAMOUNT)) File "/usr/lib/python2.5/socket.py", line 309, in read data = self._sock.recv(recv_size) error: (104, 'Connection reset by peer') What did I miss? I don't really want to catch all errors. Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: urllib2 - safe way to download something
I mean I don't want to catch all unexpected errors with empty "except:" :). -- http://mail.python.org/mailman/listinfo/python-list
Re: urllib2 - safe way to download something
On 14 нояб, 18:12, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Fri, 14 Nov 2008 06:35:27 -0800, konstantin wrote: > > Hi, > > > I wonder if there is a safe way to download page with urllib2. I've > > constructed following method to catch all possible exceptions. > > See here: > > http://niallohiggins.com/2008/04/05/python-and-poor-documentation- > urllib2urlopen-exception-layering-problems/ > > There are probably others as well... I seem to recall getting > socket.error at some point myself. > > -- > Steven Thanks. It's a nice post. But it seems there is no clear solution. I remember I've caught IOError and ValueError as well. I think urllib2 needs some unification on exception handling. It breaks simplicity and this is no good. But anyway, thanks. ps Maybe I could contribute to this module but I do not really know how and where to start. -- http://mail.python.org/mailman/listinfo/python-list
string[i:j:k]
Hello, I'm not a newbie in python, but recently faced a problem in simple expression: some_string[i:j:k] What does it mean? I believe this grammar (http://docs.python.org/ref/ slicings.html) describes the syntax. But I can't grasp it. Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: string[i:j:k]
On Jul 22, 9:18 am, alex23 <[EMAIL PROTECTED]> wrote: > On Jul 22, 3:10 pm, konstantin <[EMAIL PROTECTED]> wrote: > > > some_string[i:j:k] > > What does it mean? > > i = start position, j = end position, k = step size > > >>> s = "ABABABABABABAB" > >>> s[0:6:2] > 'AAA' > >>> s = "ABCABCABCABCABC" > >>> s[0:6:3] > > 'AA' > > Hope this helps. > > - alex23 Thanks! It seems that negative step leads in reverse direction. But logic isn't completely clear for me. >>> s = '123456789' >>> s[::-2] '97531' but >>> s[:-1:-2] '' though I expected something like '8642' What did i missed? -- http://mail.python.org/mailman/listinfo/python-list
Re: string[i:j:k]
Now it's clear. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
cache-like structure
Hi, I've write a class that actually is data structure with items that automatically removed from collection when timeout expires. Interface is pretty simple. First public method is to make a record. And second (__contains__) is to define if record is actually in table. I prefer async way to clean out expired records. Thus I have to create timeout thread every cycle to wait for the next clean-up. So my questions are: - is the implementation thread-safe (or I've missed something) - is there way to avoid creating new timer every cycle - are there better ways to do this (or any ready recipes) --- import threading import time import collections class CacheTable(object): def __init__(self, ttl): self.records = collections.deque() self.ttl = ttl self.timer = None self.mutex = threading.Lock() def record(self, item): self.mutex.acquire() try: self.records.append((time.time(), item)) if not self.timer: self.__settimer(self.ttl) finally: self.mutex.release() def __cleanup(self): self.mutex.acquire() try: current = time.time() self.timer = None while self.records: timestamp, item = self.records.popleft() if timestamp + self.ttl > current: self.records.appendleft((timestamp, item)) time_to_wait = timestamp + self.ttl - current self.__settimer(time_to_wait) break finally: self.mutex.release() def __settimer(self, timeout): self.timer = threading.Timer(timeout, self.__cleanup) self.timer.start() def __contains__(self, value): self.mutex.acquire() try: items = [item for ts, item in self.records] return items.__contains__(value) finally: self.mutex.release() --- Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: cache-like structure
> And if you change the deque for a Queue.Queue, you don't even need a > Lock... > > Cheers, > > Maxime Maxime, thanks, sched module could be a nice solution. I've never used it before but it seems to be the right way. You guessed right. I want to used it in Queue. But this implementation does not guarantee that __cleanup__ won't be invoked while __contains__ processing. > def _remove(self, rec): #try not to use __form, almost always an error >self.records.remove(rec) > > the Timer would become > Timer(ttl, self._remove, [(t, item)]) # t is the time that you got > before This solution has one shortcoming. When record() called many times during short period (almost simultaneously) the _remove(item) calls do not manage to remove records on time. So I choosed batch cleanup. But thanks for suggestion! I'll try sched. -- http://mail.python.org/mailman/listinfo/python-list
Re: RELEASED Python 2.6 final
On Oct 2, 7:46 am, Barry Warsaw <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On behalf of the Python development team and the Python community, I > am happy to announce the release of Python 2.6 final. This is the > production-ready version of the latest in the Python 2 series. > > There are many new features and modules, improvements, bug fixes, and > other changes in Python 2.6. Please see the "What's new" page for > details > > http://docs.python.org/dev/whatsnew/2.6.html > > as well as PEP 361 > > http://www.python.org/dev/peps/pep-0361/ > > While Python 2.6 is backward compatible with earlier versions of > Python, 2.6 has many tools and features that will help you migrate to > Python 3. Wherever possible, Python 3.0 features have been added > without affecting existing code. In other cases, the new features can > be enabled through the use of __future__ imports and command line > switches. > > Python 3.0 is currently in release candidate and will be available > later this year. Both Python 2 and Python 3 will be supported for the > foreseeable future. > > Source tarballs, Windows installers, and Mac disk images can be > downloaded from the Python 2.6 page: > > http://www.python.org/download/releases/2.6/ > > (Please note that due to quirks in the earth's time zones, the Windows > installers will be available shortly.) > > Bugs can be reported in the Python bug tracker: > > http://bugs.python.org > > Enjoy, > - -Barry > > Barry Warsaw > [EMAIL PROTECTED] > Python 2.6/3.0 Release Manager > (on behalf of the entire python-dev team) > > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.4.9 (Darwin) > > iQCVAwUBSOREJ3EjvBPtnXfVAQLAigP/aEnrdvAqk7wbNQLFbmBonIr2YQbd1vEu > TyTr5imYXFWGNfv1/JMeMBjMfwpHi1bgPEDTLEZdhDRNj/G1h4NqqnpfJS0lfIaU > 4JBKwnsO80se/RGyupcs5f09UdKxOljhbFKEw46CHDkd9lE+cqy2yhetEwyx3c3+ > AVC11sjcO54= > =Oxo3 > -END PGP SIGNATURE- Congratulations! Konstantin -- http://mail.python.org/mailman/listinfo/python-list
Re: Modifying a textfile
On Sep 3, 2:21 pm, Olli Virta wrote: > Hi! > > So I got this big textfile. It's full of data from a database. About > 150 or > more rows or lines in a textfile. > There's three first rows that belong to the same subject. And then > next > three rows belong to another subject and so on, to the end of the > file. > > What I need to do, is put the three rows that goes together and belong > to > certain subject, on a one line in the output textfile. And the next > three > rows again on a one new line. And that goes with the rest of the data > to > the end of the new file. > > Can't figure out a working loop structure to handle this. > > Thanks! OV Straightforward generator version. src = file('test_in.txt', 'r') dst = file('test_out.txt', 'w') def reader(src): count, lines = 0, '' for line in src: if count < 2: lines += line.strip() count += 1 else: yield lines + line count, lines = 0, '' if lines: yield lines + '\n' for lines in reader(src): dst.write(lines) -- http://mail.python.org/mailman/listinfo/python-list
Re: What makes an object uncopyable?
On 17 Jun 2005 15:41:07 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I am trying to make a copy of a certain Python object using the > copy.copy() function. When I try to perform this operation I get an > error like the following: > > copy.Error: un(shallow)copyable object of type ... > > What factors determine whether an object can be copied? You are probably trying to copy an instance of a class implemented in C extension. AFAIK, Python classes have copy support by default, but extension classes need to implement copy/pickle protocol. - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: JEP and JPype in a single process
On 6/20/05, skn <[EMAIL PROTECTED]> wrote: > Hello, > > I have written a very simple java class file, which invokes a Python script > using JEP. . . . > Now inside this Python script I want to make Java calls using JPype. I am not familiar with either Jepp or JPype, but I spotted this snippet on Jepp page (http://jepp.sourceforge.net/): import jep FileInputStream = jep.findClass('java.io.FileInputStream') try: fin = FileInputStream('adsf') except jep.FileNotFoundException: print 'Invalid file' Are you sure you need to call JPype? - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and encodings drives me crazy
On 6/20/05, Oliver Andrich <[EMAIL PROTECTED]> wrote: > Does the following code write headline and caption in > MacRoman encoding to the disk? > > f = codecs.open(outfilename, "w", "macroman") > f.write(headline) It does, as long as headline and caption *can* actually be encoded as macroman. After you decode headline from utf-8 it will be unicode and not all unicode characters can be mapped to macroman: >>> u'\u0160'.encode('utf8') '\xc5\xa0' >>> u'\u0160'.encode('latin2') '\xa9' >>> u'\u0160'.encode('macroman') Traceback (most recent call last): File "", line 1, in ? File "D:\python\2.4\lib\encodings\mac_roman.py", line 18, in encode return codecs.charmap_encode(input,errors,encoding_map) UnicodeEncodeError: 'charmap' codec can't encode character u'\u0160' in position 0: character maps to - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Question about HTMLgen
On 6/20/05, Sebastian Bassi <[EMAIL PROTECTED]> wrote: > Hello, > > I am using HTMLgen. It is very nice. But I can't make it to > generate an arbitrary command. > For example I want to output this: > > type="image/svg+xml" name="wmap" wmode="transparent"> Works for me... >>> d = HTMLgen.BasicDocument() >>> d.append('') >>> print d - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: reading a list from a file
On 6/20/05, David Bear <[EMAIL PROTECTED]> wrote: > I have a file that contains lists -- python lists. sadly, these > are not pickled. These are lists that were made using > a simple print list statement. Sad, indeed. But what kind of objects they held? Only ints? Ints and strings? Arbitrary objects? > > Is there an easy way to read this file into a list again? > I'm thinking I would have to > > read until char = '[' >read until char = " ' " > > Well, reading character by char until I have the list and then > parse it all myself. At least you can leave tokenizing to python lib: >>> import tokenize, token, pprint >>> token_names = dict([ ... (value, name) for (name, value) ... in token.__dict__.iteritems() ... if isinstance(value, int)]) >>> tokens = tokenize.generate_tokens( ... iter(['[1, 2, "ab\'c,d"]']).next) >>> pprint.pprint([(token_names[t[0]], t[1]) for t in tokens]) [('OP', '['), ('NUMBER', '1'), ('OP', ','), ('NUMBER', '2'), ('OP', ','), ('STRING', '"ab\'c,d"'), ('OP', ']')] - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Tuple Unpacking in raise
On 6/21/05, James Stroud <[EMAIL PROTECTED]> wrote: > Hello All, > > Is this a bug? No, it works as documented. You should've consulted language reference: http://docs.python.org/ref/raise.html - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Tuple Unpacking in raise
On 6/21/05, Steven Bethard <[EMAIL PROTECTED]> wrote: > James Stroud wrote: > P.S. If you insist on using the two argument version of raise, you can > do it like this: > > py> class E(Exception): > ... def __init__(self, atup): > ... Exception.__init__(self, "Error with %s-%s" % atup) > > But that seems a lot less elegant than simply using the one argument > version. Another workaround would be to use __init__(self, *atup), but raising an explicitly constructed exception is preferable (IMO). - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: after transfer of data from MS-outlook(mail ids) to application, mail ids are consisting of strange characters
On 20 Jun 2005 22:24:09 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hello all, ... > I hope somebody will help > me in this regard to unfold this mystery.Bye. I hope you will explain how this is related to Python. - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: .dll files
On 20 Jun 2005 23:56:50 -0700, Sabin.A.K <[EMAIL PROTECTED]> wrote: > > Will the COM Object be a total solution for my problems? I just try to > make a dll to encapsulate some 'icon and text' files for my > application. Are you trying to create a windows resource dll? I believe Python isn't the tool for this job. What is your main application created with? How do you plan to extract 'icons and text' from this dll? - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Howto access a enumeration in a COM TypeLib
On 6/21/05, Alexander Eisenhuth <[EMAIL PROTECTED]> wrote: > Hello alltogether, > > I hope somebody can help me in that case. I bet I have overseen s.th.. > > I have a VC++ IDispatch Com-Server (ATL) and include for error handling > issues a enumeration in the IDL-File. > > [...] > enum PROG_ERROR { > P_OK = 0, > P_ERR_01 = 1, > P_ERR_02 = 2, > ... > } > typedef enum PROG_ERROR PROG_ERROR_T; > > [...] > > I can acess the COM object using : > > obj = win32com.client.Dispatch("...") > > and can Load the TypeLib: > > lib = pythonwin.LoadTypeLib("...") > > and see the enumeration in the OLE-Browser of Windows, but don't know > how to access the enum in Python. > > Any help and hints are very welcome. > > Regards > Alexander > > PS.: I use the actual version of ActivePython 2.4. Use site-packages/win32com/client/makepy.py to produce myserver.py from your typelib file, then >>> import myserver >>> print myserver.constants. P_OK 0 Maybe you can access constants without makepy, I don't know. - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Using code objects?
On 6/21/05, Chinook <[EMAIL PROTECTED]> wrote: > > When I create the code objects though, it seems a couple different ways work > and I'm wondering which is better and why (or is there a more correct > technique in this situation)? > > The two different ways are illustrated below: ... > >>> obj1 = compile(exp1, 'whatever', 'single') ... > >>> obj2 = compile(exp2, 'whatever', 'exec') Are you essentially asking about difference between compile(..., 'single') and compile(..., 'exec'), which is described in http://docs.python.org/lib/built-in-funcs.html ? - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Python choice of database
On 6/21/05, Charles Krug <[EMAIL PROTECTED]> wrote: > > Related question: > > What if I need to create/modify MS-Access or SQL Server dbs? You could use ADO + adodbapi for both. http://adodbapi.sourceforge.net/ - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Loop until condition is true
On 6/21/05, Magnus Lycka <[EMAIL PROTECTED]> wrote: > I don't know anything about the Python compiler internals, > but it doesn't seem very hard to identify simple literals following > while and if, and to skip the runtime test. (Perhaps it's done > already?) True doesn't seem to be a literal, it is looked up by name and can be rebound to, say, 0 anytime: >>> import dis >>> o = compile('while True: pass', '', 'exec') >>> dis.dis(o) 1 0 SETUP_LOOP 12 (to 15) >>3 LOAD_NAME0 (True) 6 JUMP_IF_FALSE4 (to 13) 9 POP_TOP 10 JUMP_ABSOLUTE3 ... OTOH, >>> p = compile('while 1: pass', '', 'exec') >>> dis.dis(p) 1 0 SETUP_LOOP 5 (to 8) >>3 JUMP_ABSOLUTE3 ... - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: utf8 silly question
On 6/21/05, Jeff Epler <[EMAIL PROTECTED]> wrote: > If you want to work with unicode, then write > us = u"\N{COPYRIGHT SIGN} some text" ...and you can get unicode character names like that from unicodedata module: >>> import unicodedata >>> unicodedata.name(unichr(169)) 'COPYRIGHT SIGN' See also http://www.unicode.org/charts/charindex.html - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: suggestions invited
On 22 Jun 2005 02:47:06 -0700, Aditi <[EMAIL PROTECTED]> wrote: > i have to make a system used by the IT department of a company which > contains 31 applications and their details which are being used in a > company ...the details are... > Application sub application catagoryplatform > languageversion IT > owner functional ownerremarks source code documentation > last updated > dates > i want to design a system such that it lets the it employee enter the > name of the application and gives him all the details about it...please > suggest an appropriate design Ahem... Create a directory "appmon". In this directory create a text file for each application. Put application details in file and name it after application name. Users will be able to view details of a particular application by using "cat appname" on unix or "type appname" on windows, thus it is a portable solution. I believe this design fits your requirements :) - kv -- http://mail.python.org/mailman/listinfo/python-list
Re:
On 6/22/05, Doug Ly <[EMAIL PROTECTED]> wrote: > Is there a good IDE for Python? See http://tinyurl.com/8jqjc - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Python API to manipulate CAB files.
On 6/22/05, Peter Maas <[EMAIL PROTECTED]> wrote: > Isaac Rodriguez schrieb: > > Does anyone know of a Python API to manipulate CAB files? I guess you'll have to interface with setupapi.dll (SetupIterateCabinet) via ctypes, or with Microsoft Cabinet utilities via subprocess module. Neither is what people call fun... - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Avoiding deadlocks in concurrent programming
On 6/23/05, Steve Horsley <[EMAIL PROTECTED]> wrote: > It is my understanding that Pythons multithreading is done at the > interpteter level and that the interpreter itself is single > threaded. In this case, you cannot have multiple threads running > truly concurrently even on a multi-CPU machine Python uses native threads. >>> import thread, win32api >>> win32api.GetCurrentThreadId() 1532 >>> def t(): ... print win32api.GetCurrentThreadId() ... >>> for i in range(10): ... thread.start_new_thread(t, ()) ... 1212 1804 804 1276 1792 ... - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Detect windows shutdown
On 6/22/05, Austin <[EMAIL PROTECTED]> wrote: > My program is running on windows and it is wrritten by Python and wxPython, ... > Is there any way to dectect windows shutdown or reboot? Will wx.EVT_END_SESSION or wx.EVT_QUERY_END_SESSION help? - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Avoiding deadlocks in concurrent programming
On 22 Jun 2005 17:50:49 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > Even on a multiprocessor > system, CPython (because of the GIL) doesn't allow true parallel > threads, ... . Please excuse my ignorance, do you mean that python threads are always scheduled to run on the same single CPU? Or just that python threads are often blocked waiting for GIL? - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP ? os.listdir enhancement
On 6/22/05, Riccardo Galli <[EMAIL PROTECTED]> wrote: > I propose to add an 'abs' keyword which would make os.listdir return the > absolute path of files instead of a relative path. What about os.listdir(dir='relative/path', abs=True)? Should listdir call abspath on results? Should we add another keyword rel? Would it complicate listdir unnecessarily? - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: string capitalize sentence
On 6/24/05, dimitri pater <[EMAIL PROTECTED]> wrote: > a = 'harry is a strange guy. so is his sister, but at least she is not a > guy. i am.' > b = a.replace('. ', '.') > splitlist = b.split('.') > newlist = [] > for i in range(len(splitlist)): > i = ''.join(splitlist[i].capitalize() + '.' > newlist.append(i) > cap = ' '.join(newlist).replace(' .', '') > print cap A simpler version would be: >>> s = 'harry is a strange guy. so is his sister, but at least she is not a guy . i am.' >>> a = s.split('. ') # you can split at multicharacter strings >>> b = (x.capitalize() for x in a) # you can use generator expressions to generate lists >>> '. '.join(b) 'Harry is a strange guy. So is his sister, but at least she is not a guy. I am.' > it doesn't work with: > is harry a strange guy? so is his sister, but at least she is not a guy. i > am. I believe you'll need re.split to accomplish that. Regards, - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: suggestions invited
On 23 Jun 2005 12:30:27 -0700, Aditi <[EMAIL PROTECTED]> wrote: > Thanks for ur effort... And I apologise for being sloppy in writing. > Well I agree the whole project sounds fictitious because it has been > assigned to me in that spirit. The project was explained to me in > just 5 minutes and so these are the only details I have and the only > documentation I have is a list of the 31 applications used in the > company and that the platform used in the company is OS 400. Pardon me, is it a real company or a fictious one? > > The reason why I posted this mail was to invite ideas as to how could I > make the best use of these details and suggestions because I myself > found these details way too less. I think I should have written about > this in the first mail to avoid frustration to the people who are > trying to help > me. > Anyways now that it is known that the project has been assigned to me > just for the heck of it would like to make my project such that they > want to use it...I would definately not let my work go wasted...So do > let me know what you think could be done in this direction. If you have real users, your first step is to talk to them to define project goals. Everything else (xml, python, etc.) is irrelevant until you know *what* you want to build. Go talk to your potential users, know why (if at all) they need this monitoring system, learn their current tools and processes, see how your system could help them do their job more efficiently. Don't start coding until you have clear understanding of requirements. There are lots of nice intelligent people on this list, but they can't substitute people you are building this system for :) - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: printing indented html code
On 6/24/05, Lowell Kirsh <[EMAIL PROTECTED]> wrote: > Is there a module or library anyone knows of that will print html code > indented? Depends on whether you have to deal with xhtml, valid html or just any, possibly invalid, "pseudo-html" that abounds on the net. Here's an example of (too) simple html processing using standard HTMLParser module: from HTMLParser import HTMLParser class Indenter(HTMLParser): def __init__(self, out): HTMLParser.__init__(self) self.out = out self.indent_level = 0 def write_line(self, text): print >> self.out, '\t' * self.indent_level + text def handle_starttag(self, tag, attrs): self.write_line( '<%s %s>' % (tag, ' '.join('%s=%s' % (k, v) for k, v in attrs)) ) self.indent_level += 1 def handle_endtag(self, tag): self.indent_level -= 1 self.write_line('' % tag) handle_data = write_line # handle everything else... # http://docs.python.org/lib/module-HTMLParser.html if __name__ == '__main__': import sys i = Indenter(sys.stdout) i.feed('foobarbody') i.close() - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: windows service problem
On 6/24/05, Austin <[EMAIL PROTECTED]> wrote: > def __init__(self,args): > win32serviceutil.ServiceFramework.__init__(self,args) > self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) > self.check = 1 Change last two lines to self.check = 1 self.hWaitStop = win32event.CreateEvent(None, 0, 1, None) (SvcDoRun is waiting for hWaitStop event, but you never signal it.) - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Office COM automatisation - calling python from VBA
On 6/25/05, Stephen Prinster <[EMAIL PROTECTED]> wrote: > guy lateur wrote: > > If you are new to Python and want to use it with COM, definitely get > yourself a copy of _Python Programming on Win32_ by Mark Hammond and > Andy Robinson. ...or at least read the chapter available online: http://www.oreilly.com/catalog/pythonwin32/chapter/ch12.html It has an example of VBA / PythonCOM interaction. - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Office COM automatisation - calling python from VBA
On 6/25/05, Josef Meile <[EMAIL PROTECTED]> wrote: > You could try to do an addin/addon for Word, Excel, and Outlook. You > don't need to code with VBA. Here you just need a language from where > you can access the microsoft interop assemblies (ie: C++ or C#; > IronPython maybe?) Hmm... Why jump through .NET hoops when all you need is COM? I suppose msoffice interops are no different than other .NET interops, which are just that - .NET/COM interoperability layer. There's no need for them unless you're calling COM from .NET. For CPython win32com should be enough. - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: super problem
On 6/25/05, Uwe Mayer <[EMAIL PROTECTED]> wrote: > AFAIK super only works with new-style classes, so I checked: > > >>> from qtcanvas import * > >>> isinstance(QCanvasItem, object) > True AFAIK, this is not the right way to check for new-styledness: >>> class X: "i'm an old-styler" >>> isinstance(X(), object) True But this is: >>> isinstance(X, type) False - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Favorite non-python language trick?
On 6/25/05, Mandus <[EMAIL PROTECTED]> wrote: > It is really a consensus on this; that > removing map, filter, reduce is a good thing? It will render a whole lot > of my software unusable :( I think you'll be able to use "from __past__ import map, filter, reduce" or something like that :) They don't have to be built-in. - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Favorite non-python language trick?
On 6/25/05, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 24 Jun 2005 14:29:37 -0700, James wrote: > > 2.) Contracts > > Explain please. James probably meant Eiffel's Design by Contract. My favourite Python implementation is Terence Way's http://www.wayforward.net/pycontract/ ;-) - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Favorite non-python language trick?
On 6/25/05, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sat, 25 Jun 2005 17:41:58 +0200, Konstantin Veretennicov wrote: > > > On 6/25/05, Mandus <[EMAIL PROTECTED]> wrote: > >> It is really a consensus on this; that > >> removing map, filter, reduce is a good thing? It will render a whole lot > >> of my software unusable :( > > > > I think you'll be able to use "from __past__ import map, filter, > > reduce" or something like that :) They don't have to be built-in. > > More likely they will be moved to something like itertools than "__past__". > > Or just define them yourself: > > def map(f, seq): > return [f(x) for x in seq] > > def filter(p, seq): > return [x for x in seq if p(x)] > > def reduce(f, seq, zero): > r = zero > for x in seq: r = f(r, x) > return r FWIW, these don't exactly reproduce behaviour of current built-ins. Filter, for instance, doesn't always return lists and map accepts more than one seq... Just my $.02. - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Favorite non-python language trick?
On 25 Jun 2005 12:17:20 -0700, George Sakkis <[EMAIL PROTECTED]> wrote: > If they go to itertools, they can simply be: > > def map(f, *iterables): > return list(imap(f,*iterables)) > > def filter(f, seq): > return list(ifilter(f,seq)) >>> from itertools import ifilter >>> def filter(f, seq): ... return list(ifilter(f,seq)) >>> filter(str.isalpha, 'not quite!') ['n', 'o', 't', 'q', 'u', 'i', 't', 'e'] >>> __builtins__.filter(str.isalpha, 'not quite!') 'notquite' - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: noob question
On 6/26/05, Matt Hollingsworth <[EMAIL PROTECTED]> wrote: > Seems like an _extremely_ elegent language that is very easy to read, so > I suppose it's not really as much of an issue as it is with other > languages. Still, I would like to see what other people do and what are > some good ideas for this kind of thing. Nouns-for-variables vs. verbs-for-functions work for me equally well in Python, C++ and C#. I rarely feel the need for hungarian notation, but it has it's uses (and abuses); see http://joelonsoftware.com/articles/Wrong.html - kv -- http://mail.python.org/mailman/listinfo/python-list
Decimal(1) > 0.0 == False
Hello, I'm having hard time trying to justify this decimal quirk to my coworker (he calls it a bug): ActivePython 2.4.1 Build 247 (ActiveState Corp.) based on Python 2.4.1 (#65, Jun 20 2005, 17:01:55) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import decimal >>> 2.0 > decimal.Decimal(1) > 0.0 False Why False? It's so counter-intuitive. I understand that it may not be possible to do precise comparison of decimal and float, but an exception would be so much better than silent False! - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Single test for a class and all its subclasses?
On 6/15/05, Anthra Norell <[EMAIL PROTECTED]> wrote: > > class C: ... > class C2 (C): ... > > # What I want to do: > > if x.__class__ in (C, C2): >do_something_with (x) If you have an instance, you can use isinstance() built-in. - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: pyunit: remove a test case on the fly
On 15 Jun 2005 14:13:09 -0700, chris <[EMAIL PROTECTED]> wrote: > We have a number of TestCase classes that have multiple test methods. > We are interested in removing any of the individual test methods on the > fly (dynamically, at runtime, whatever). Here's a simple approach imitating NUnit's CategoryAttribute. I don't know whether it'll work for you, it depends on what exactly isSupported() does. - kv import unittest def category(*test_categories): tc = frozenset(test_categories) def f(g): if tc & frozenset(active_categories): return g # else return None, # effectively removing test from TestCase return f active_categories = ['mac', 'nt'] class T(unittest.TestCase): @category('mac') def test_a(self): print 'mac only' @category('posix') def test_b(self): print 'posix only' @category('posix', 'nt') def test_c(self): print 'posix or nt' def test_d(self): print 'platform-independent' if __name__ == '__main__': unittest.main() -- http://mail.python.org/mailman/listinfo/python-list
Re: Set of Dictionary
On 6/16/05, Vibha Tripathi <[EMAIL PROTECTED]> wrote: > Hi Folks, > > I know sets have been implemented using dictionary but > I absolutely need to have a set of dictionaries... While you can't have a set of mutable objects (even dictionaries :)), you can have a set of immutable snapshots of those objects: >>> d1 = {1: 'a', 2: 'b'} >>> d2 = {3: 'c'} >>> s = set([tuple(d1.iteritems()), tuple(d2.iteritems())]) >>> s set([((3, 'c'),), ((1, 'a'), (2, 'b'))]) >>> [dict(pairs) for pairs in s] [{3: 'c'}, {1: 'a', 2: 'b'}] - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Set of Dictionary
On 6/16/05, Vibha Tripathi <[EMAIL PROTECTED]> wrote: > I need sets as sets in mathematics: That's tough. First of all, mathematical sets can be infinite. It's just too much memory :) Software implementations can't fully match mathematical abstractions. >sets of any unique type of objects including those > of dictionaries, I should then be able to do: > a_set.__contains__(a_dictionary) and things like that. Maybe you can use a list for that: >>> d1 = {1: 2} >>> d2 = {3: 4} >>> s = [d1, d2] >>> {1: 2} in s True >>> {5: 6} in s False > Can sets in Python 2.4.1, be reimplemented from > scratch to not have it work on top of dict? Sure, why not? - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: which ports to use for SOAP?
On 6/17/05, Maurice LING <[EMAIL PROTECTED]> wrote: > Hi, > > I'm writing something that specifies the use of SOAP. One requirement > that fumbles me is the port number(s) to use. (I assume you're talking about TCP ports, not SOAP ports.) > Is there any way to find > out which ports are not used by the system? Try binding to a port and you'll get an 'Address already in use error' if it's occupied :) > I've looked in the library > reference and doesn't seems to get anything. > > Is there a problem with say 2 programs using the same ports? AFAIK, even the same process can't bind to the same port twice: >>> import socket >>> s1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) >>> s1.bind(('localhost', 8000)) >>> s2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) >>> s2.bind(('localhost', 8000)) Traceback (most recent call last): File "", line 1, in ? File "", line 1, in bind socket.error: (10048, 'Address already in use') - kv -- http://mail.python.org/mailman/listinfo/python-list
thread.start_new_thread question
Hi, Just curious: >>> import thread >>> help(thread.start_new_thread) . . . start_new_thread(function, args[, kwargs]) . . . Second argument is mandatory. Is it incidental or for a reason? - kv -- http://mail.python.org/mailman/listinfo/python-list
Re: thread.start_new_thread question
On 6/17/05, Brian <[EMAIL PROTECTED]> wrote: > Hi KV, > > Here's a site that provides an easy, beginners example of how to do > threading. You might find this useful too... :-) > > http://www.codesampler.com/python.htm > (Look for the "Spawning Threads" section.) Thank you, but that doesn't answer my question. I was asking if there is a reason that "args" is not optional. Oftentimes functions I use to start_new_thread have no arguments (they may get data from bound instance or from closure), but still I have to pass empty "args", always wondering, why? Python lib generally has a very nice and convenient interface and tries to supply sensible defaults when possible. That "args" is a required argument is a mystery to me :) - kv A. No. Q. Is top posting OK? -- http://mail.python.org/mailman/listinfo/python-list
MFC app to Python IDLE communication
Hi all In my MFC application I need to call Python IDLE, pass some terms (or scripts or values - they are simple strings or memo fields) there so that user may modify/evaluate/interpret it and then return the modified terms back to the application. How can I do it the best way (MFC->IDLE)? As for IDLE->MFC, I'm afraid that copy-paste is the way out... Is it so? Thanks in advance for the hints. -- http://mail.python.org/mailman/listinfo/python-list
Re: MFC app to Python IDLE communication
> IDLE is a Tkinter/TK IDE for Python... Why would you invoke a whole > IDE to manipulate application data? It was just an idea. I have never dealt with python before... I need some hints to understand where the answer to my problem is. > > If you already have MFC in the mix, wouldn't it be better to use > the win32 python extensions and keep everything in MFC? as I understand you suggest to extend win32 python to my needs? -- http://mail.python.org/mailman/listinfo/python-list
Re: stdin, stdout, redmon
Hi, This is Windows bug that is described here: http://support.microsoft.com/default.aspx?kbid=321788 This article also contains solution: you need to add registry value: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies \Explorer InheritConsoleHandles = 1 (REG_DWORD type) Do not forget to launch new console (cmd.exe) after editing registry. Alternatively you can use following command cat file | python script.py instead of cat file | python script.py Regards, Konstantin On Jan 22, 1:02 pm, Rolf van de Krol <[EMAIL PROTECTED]> wrote: > Well, that's at least weird. I did test my code with Python 2.5 on Win > XP, using the command prompt. But testing it with IDLE gives exactly the > same error Bernard has. So apparently STDIN can't be accessed with IDLE. > > Rolf > > John Machin wrote: > > > Excuse me, gentlemen, may I be your referee *before* you resort to > > pistols at dawn? > > > = IDLE = > > IDLE 1.2.1 > > >>>> import sys > >>>> sys.stdin.readlines > > > Traceback (most recent call last): > > File "", line 1, in > > sys.stdin.readlines > > AttributeError: readlines > > > = Command Prompt = > > C:\junk>python > > Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit > > (Intel)] on win32 > > Type "help", "copyright", "credits" or "license" for more information. > > >>>> import sys > >>>> sys.stdin.readlines > > > > > > HTH, > > John -- http://mail.python.org/mailman/listinfo/python-list
Re: stdin, stdout, redmon
Sorry, I meant: Alternatively you can use following command cat file | python script.py instead of cat file | script.py On Jan 22, 1:54 pm, Konstantin Shaposhnikov <[EMAIL PROTECTED]> wrote: > Hi, > > This is Windows bug that is described > here:http://support.microsoft.com/default.aspx?kbid=321788 > > This article also contains solution: you need to add registry value: > > HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies > \Explorer > InheritConsoleHandles = 1 (REG_DWORD type) > > Do not forget to launch new console (cmd.exe) after editing registry. > > Alternatively you can use following command > > cat file | python script.py > > instead of > > cat file | python script.py > > Regards, > Konstantin > > On Jan 22, 1:02 pm, Rolf van de Krol <[EMAIL PROTECTED]> wrote: > > > Well, that's at least weird. I did test my code with Python 2.5 on Win > > XP, using the command prompt. But testing it with IDLE gives exactly the > > same error Bernard has. So apparently STDIN can't be accessed with IDLE. > > > Rolf > > > John Machin wrote: > > > > Excuse me, gentlemen, may I be your referee *before* you resort to > > > pistols at dawn? > > > > = IDLE = > > > IDLE 1.2.1 > > > >>>> import sys > > >>>> sys.stdin.readlines > > > > Traceback (most recent call last): > > > File "", line 1, in > > > sys.stdin.readlines > > > AttributeError: readlines > > > > = Command Prompt = > > > C:\junk>python > > > Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit > > > (Intel)] on win32 > > > Type "help", "copyright", "credits" or "license" for more information. > > > >>>> import sys > > >>>> sys.stdin.readlines > > > > > > > > HTH, > > > John -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and xml
On Sat, Mar 29, 2008 at 3:57 PM, Doran, Harold <[EMAIL PROTECTED]> wrote: > I am a python neophyte who has used python to parse through text files > using basic functions and no OOP experience. I have a need to process some > xml files and from what I am now reading python is the exact tool I need to > work through this issue. > > However, as I read online docs and peruse which books to buy, I am quickly > becoming overwhelmed with the topic and could use some guidance on how to > best tackle my task. > > You can start with this basic example (requires Python 2.5): spam.xml: Dinsdale (Face the Press) The Spanish Inquisition Deja vu The Buzz Aldrin Show Live From the Grill-O-Mat Snack Bar It's a Living The Attila the Hun Show Archaeology Today How to Recognize Different Parts of the Body Scott of the Antarctic How Not to Be Seen Spam Royal Episode 13 spam.py: from xml.etree.ElementTree import ElementTree as ET et = ET(file='spam.xml') for episode in et.findall('episode'): print episode.attrib['number'] + ':', '"' + episode.text + '"' Use standard csv module if you want to produce csv ouput ( http://docs.python.org/lib/module-csv.html). -- kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Create executable from executable with py2exe
On Sat, Mar 29, 2008 at 3:23 PM, <[EMAIL PROTECTED]> wrote: > Hello, > > Is there any example how can I create executable ... with py2exe > Check out PyBuilder's source code (http://pybuilder.sourceforge.net/). -- kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Why prefer != over <> for Python 3.0?
On Tue, Apr 1, 2008 at 12:04 PM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Tue, 01 Apr 2008 04:15:57 -0300, Jorge Vargas <[EMAIL PROTECTED]> > escribió: > > > as for the original question, the point of going unicode is not to > > make code unicode, but to make code's output unicode. thin of print > > calls and templates and comments the world's complexity in languages. > > sadly most english speaking people think unicode is irrelevant because > > ASCII has everything, but their narrow world is what's wrong. > > Python 3 is a good step in that direction. Strings are unicode, > identifiers are not restricted to ASCII, and the default source encoding > is not ASCII anymore (but I don't remember which one). UTF-8 (http://python.org/dev/peps/pep-3120/) -- kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Is this a good time to start learning python?
> > > > > Backward compatibility is important. C++ could break all ties with > C > > > to "clean up" as well, but it would be a braindead move that would > > > break existing code bases upon upgrade. > > > > C++ is not C. No one "upgrades" from C to C++. > > You misunderstand. C++ has a lot of "warts" to maintain backwards > compatibility with C. The standards committee could eliminate these > warts to make the language "cleaner", but it would break a lot of > systems. > Didn't C++ "break" all C programs that happened to use "class" for identifier? :) -- kv -- http://mail.python.org/mailman/listinfo/python-list
Re: XML Parsing
On Tue, Apr 1, 2008 at 10:42 PM, Alok Kothari <[EMAIL PROTECTED]> wrote: > Hello, > I am new to XML parsing.Could you kindly tell me whats the > problem with the following code: > > import xml.dom.minidom > import xml.parsers.expat > document = """Lettermanis token>betterthan token>JayLeno""" > This document is not well-formed. It doesn't have root element. ... > > Traceback (most recent call last): > File "C:/Python25/Programs/eg.py", line 20, in >p.Parse(document, 1) > ExpatError: junk after document element: line 1, column 33 > Told ya :) Try wrapping your document in root element, like ".." -- kv -- http://mail.python.org/mailman/listinfo/python-list
Re: import multiple modules with same name
On Mon, Mar 31, 2008 at 11:52 PM, Christian Bird <[EMAIL PROTECTED]> wrote: > Is it possible to import multiple modules with the same name from > different locations? This might work: import imp util1 = imp.load_source('util1', 'mod1/util.py') util2 = imp.load_source('util2', 'mod2/util.py') But using packages is cleaner. -- kv -- http://mail.python.org/mailman/listinfo/python-list
Re: xlrd and cPickle.dump
On Wed, Apr 2, 2008 at 5:23 PM, <[EMAIL PROTECTED]> wrote: > Still no luck: > > Traceback (most recent call last): > File "C:\Python24\Lib\site-packages\pythonwin\pywin\framework > \scriptutils.py", line 310, in RunScript >exec codeObject in __main__.__dict__ > File "C:\text analysis\pickle_test2.py", line 13, in ? > cPickle.dump(Data_sheet, pickle_file, -1) > PicklingError: Can't pickle : attribute lookup > __builtin__.module failed > > My code remains the same, except I added 'wb' and the -1 following > your suggestions: > > import cPickle,xlrd, sys > > print sys.version > print xlrd.__VERSION__ > > data_path = """C:\\test\\test.xls""" > pickle_path = """C:\\test\\pickle.pickle""" > > book = xlrd.open_workbook(data_path) > Data_sheet = book.sheet_by_index(0) > > pickle_file = open(pickle_path, 'wb') > cPickle.dump(Data_sheet, pickle_file, -1) > pickle_file.close() > FWIW, it works here on 2.5.1 without errors or warnings. Ouput is: 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] 0.6.1 ... > My code does this, except sort returns None, which is strange. list.sort() is documented to return None. See sorted(). -- kv -- http://mail.python.org/mailman/listinfo/python-list
Re: non-terminating regex match
On Wed, Apr 2, 2008 at 9:32 PM, Maurizio Vitale <[EMAIL PROTECTED]> wrote: > Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > > > On Wed, 02 Apr 2008 16:01:59 +, Maurizio Vitale wrote: > > > >> And yes, I'm a total beginner when it comes to Python, but it seems > >> very strange to me that a regex match on a finite length string > >> doesn't terminate > > > > It does terminate, you just don't wait long enough. Try it with fewer > > characters and then increase the identifier character by character and > > watch the time of the runs grow exponentially. > > > > Ok. Now, my assumption was that re.compile would produce a DFA (or NFA) > and the match would then being linear in the size of the string. > No, it's easy to come up with regex that would perform exponentially by nesting repeated groups. > Apparently this is not the case, so is there anything that can be done > to the regex itself to make sure that whatever re.compile produces is > more efficient? Avoid catastrophic backtracking: http://www.regular-expressions.info/catastrophic.html -- kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Python queue madness
On Wed, Apr 2, 2008 at 4:52 PM, nnp <[EMAIL PROTECTED]> wrote: > > Is there any other way for data to get onto a queue Yes, by manipulating Queue.Queue's internal "queue" attribute directly. > or are there any known bugs with Python's Queue module that could lead to > this kind of behaviour? > Much more likely your code has some unexpected behavior. Could you arrange a minimal example that reproduces the problem? -- kv -- http://mail.python.org/mailman/listinfo/python-list
Re: default method parameter behavior
On Wed, Apr 2, 2008 at 10:59 PM, <[EMAIL PROTECTED]> wrote: > I ran into a similar situation like the following (ipython session). > Can anyone please explain why the behavior? Of course. >From http://docs.python.org/ref/function.html: Default parameter values are evaluated when the function definition is executed. This means that the expression is evaluated once, when the function is defined, and that that same ``pre-computed'' value is used for each call. This is especially important to understand when a default parameter is a mutable object, such as a list or a dictionary: if the function modifies the object (e.g. by appending an item to a list), the default value is in effect modified. -- kv -- http://mail.python.org/mailman/listinfo/python-list
Re: UML reverse engineering
On Fri, Apr 4, 2008 at 6:51 PM, <[EMAIL PROTECTED]> wrote: > Hello, > > Do you know a free software witch can compute a UML class diagram from a > python code. I tested many free UML softwares like BoUML, ArgoUML, Dia, > PNSource (not found) ... Did you mean /PyNSource/ ? (http://www.atug.com/andypatterns/pynsource.htm) -- kv -- http://mail.python.org/mailman/listinfo/python-list
Re: urllib and bypass proxy
On Thu, Apr 3, 2008 at 9:21 PM, kc <[EMAIL PROTECTED]> wrote: > If this has value, do I submit a bug report or does > someone else? You do :) (http://bugs.python.org) -- kv -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Data Utils
On Sun, Apr 6, 2008 at 7:43 AM, Jesse Aldridge <[EMAIL PROTECTED]> wrote: > In an effort to experiment with open source, I put a couple of my > utility files up http://github.com/jessald/python_data_utils/ > tree/master">here. What do you think? Would you search for, install, learn and use these modules if *someone else* created them? -- kv -- http://mail.python.org/mailman/listinfo/python-list
Re: makepy.py not working
On Tue, Apr 8, 2008 at 4:18 PM, <[EMAIL PROTECTED]> wrote: > Hallo, > > I've a problem getting makepy running. When I start the tool on my > machine with doubleclick everything is fine. > But when I try this in my Code: > > makepy.py -i "Microsoft Excel 11.0 Object Library(1.5)" This syntax is used to run makepy.py script from command line. > > I am getting an Syntax Error and command: > > makepy.py > > bring me this message on the screen: > > Traceback (most recent call last): > File "", line 1, in > NameError: name 'makepy' is not defined > > Any ideas what I am doing wrong? Python interpreter obviously accepts only valid python code, like this: import win32com.client.makepy win32com.client.makepy.ShowInfo("Microsoft Excel 11.0 Object Library(1.5)") -- kv -- http://mail.python.org/mailman/listinfo/python-list