regular expression - matches

2006-07-21 Thread abcd
how can i determine if a given character sequence matches my regex, completely? in java for example I can do, Pattern.compile(regex).matcher(input).matches() this returns True/False whether or not input matches the regex completely. is there a matches in python? -- http://mail.python.org/mailm

Re: regular expression - matches

2006-07-21 Thread abcd
yea i saw thatguess I was trusting that my regex was accurate :) ...b/c i was getting a Matcher when I shouldnt have, but i found that it must be the regex. -- http://mail.python.org/mailman/listinfo/python-list

problem with regex

2006-07-28 Thread abcd
I have a regex: '[A-Za-z]:\\([^/:\*\?"<>\|])*' when I do, re.compile('[A-Za-z]:\\([^/:\*\?"<>\|])*') ...I get sre_constants.error: unbalanced parenthesis do i need to escape something else? i see that i have matching parenthesis. thx -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with regex

2006-07-28 Thread abcd
well thanks for the quick replies, but now my regex doesn't work. [code] import re p = re.compile(r'[A-Za-z]:\\([^/:\*?"<>\|])*') x = p.match("c:\test") [/code] x is None any ideas why? i escape the back-slash, the asterisk *, and the PIPE | b/c they are regex special characters. -- http

Re: problem with regex

2006-07-28 Thread abcd
sorry i forgot to escape the question mark... > [code] > import re > p = re.compile(r'[A-Za-z]:\\([^/:\*?"<>\|])*') even when I escape that it still doesnt work as expected. p = re.compile(r'[A-Za-z]:\\([^/:\*\?"<>\|])*') p.match('c:\test') still returns None. -- http://mail.python.org/mailm

Re: problem with regex

2006-07-28 Thread abcd
Sybren Stuvel wrote: > Yes, because after the "c:" you expect a backslash, and not a tab > character. Read the manual again about raw strings and character > escaping, it'll do you good. doh. i shall do that. thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with regex

2006-07-28 Thread abcd
not sure why this passes: >>> regex = r'[A-Za-z]:\\([^/:\*\?"<>\|])*' >>> p = re.compile(regex) >>> p.match('c:\\test') <_sre.SRE_Match object at 0x009D77E0> >>> p.match('c:\\test?:/') <_sre.SRE_Match object at 0x009D7720> >>> the last example shouldnt give a match -- http://mail.python.org/ma

regex for replacing \r\n

2006-08-07 Thread abcd
I am trying to get a regex that will match \r\n in a string. ultimately i am trying to replace all \r\n with somethign else, say BLAH. For example: This is a message on a new line would become: This is a messageBLAHon a new line. any ideas? i tried re.compile('\r\n').match("This is a message"

format a number for output

2006-08-07 Thread abcd
if i have a number, say the size of a file, is there an easy way to output it so that it includes commas? for example: 1890284 would be: 1,890,284 I am looking for something builtin to python, not a third party lib. thanks -- http://mail.python.org/mailman/listinfo/python-list

Strange Behavior

2006-10-16 Thread abcd
class Foo: def __init__(self, name, data=[]): self.name = name self.data = data def addData(self, val): self.data.append(val) f = Foo('a') f.addData(1) f.addData(2) f2 = Foo('b') print f.name, f.data print f2.name, f2.data OUTPUT --

Re: Strange Behavior

2006-10-16 Thread abcd
Rob Williscroft wrote: > http://docs.python.org/ref/function.html#l2h-619 thanks. weird that it works that way since they even state "This is generally not what was intended." oh well. -- http://mail.python.org/mailman/listinfo/python-list

Tertiary Operation

2006-10-17 Thread abcd
x = None result = (x is None and "" or str(x)) print result, type(result) --- OUTPUT --- None y = 5 result = (y is 5 and "it's five" or "it's not five") print result - OUTPUT - it's five ...what's wrong with the first operation I did with x?

Re: Tertiary Operation

2006-10-17 Thread abcd
Carsten Haese wrote: > Use Python 2.5 where there is a true conditional > expression or find another way to solve your problem. python 2.5 once we upgrade (hopefully soon), anyways...an earlier post suggested the inverse... x = None result = (x is not None and str(x) or "") which works just fine

Problem creating animated gif

2006-10-17 Thread abcd
I am using gifmaker.py from PIL v1.1.5 on python 2.4.1. CODE import ImageGrab, gifmaker seq = [] while keepOnGoing: im = ImageGrab.grab() seq.append(im) fp = open("out.gif", "wb") gifmaker.makedelta(fp, seq) fp.close() --

PIL: Image.draft -- what are the modes that I can use?

2006-10-18 Thread abcd
I have PIL 1.1.5 on python 2.4.1 and I am attempting to get a smaller (file size) of an image. for example: im = ImageGrab.grab() im.save("tmp.gif") about 1.7mb im.save("tmp.jpeg") about 290kb anyways I want to save the image as a GIF, but not have it be so largeso I thought th

Re: Image.draft -- what are the modes that I can use?

2006-10-18 Thread abcd
Fredrik Lundh wrote: > GIF is horribly unsuitable for screenshots on modern machines. have you > considered using PNG ? > > or even better, Flash? well I am trying to take screenshots and make them into an animated GIF, however, putting them into a Flash movie would be coolany idea how to go

Re: Image.draft -- what are the modes that I can use?

2006-10-18 Thread abcd
oh and vnc2swf would not be an option, i cant be setting up a vnc server, etc. just need to use python (and necessary packages). animated gif would probably be best i am assuming. -- http://mail.python.org/mailman/listinfo/python-list

Re: Image.draft -- what are the modes that I can use?

2006-10-18 Thread abcd
Fredrik Lundh wrote: > to repeat myself: > > here's a tool that lets you use VNC to capture the screen, and then > convert > the result to a flash animation: > >http://www.unixuser.org/~euske/vnc2swf/ > > is there a way to make animated GIFs with python? vnc2swf is to much for w

Re: Image.draft -- what are the modes that I can use?

2006-10-18 Thread abcd
fredrik, in other posts you have mentioned the use of gifmaker. i have tried that with the following: I am using gifmaker.py from PIL v1.1.5 on python 2.4.1. CODE import ImageGrab, gifmaker seq = [] while keepOnGoing: im =

Re: Image.draft -- what are the modes that I can use?

2006-10-18 Thread abcd
Brett Hoerner wrote: > Are you sure you can't use VNC? An animated GIF based on full-screen > grabs will be amazingly huge and have very low color quality at the > same time. > > Installing VNC on Windows should take you about 30 seconds, honest. > > Or is this for some sort of project where you c

Re: Image.draft -- what are the modes that I can use?

2006-10-19 Thread abcd
Gabriel Genellina wrote: > A VNC server is about 400K in size... Yea, VNC is not an option in my case. thanks anyway, perhaps I'll look into generating a slideshow using HTML/javascript which can load the images. -- http://mail.python.org/mailman/listinfo/python-list

wxPython TextCtrl - weird scrolling behavior

2006-10-30 Thread abcd
I have a TextCtrl which is set to be multi-line. I have a function say, updateText(msg), which takes some string and appends it to the text control... txtControl.AppendText(msg) however, if the text that I am appending would cause the scroll bars to appear/or scroll since the text is long th

Re: wxPython TextCtrl - weird scrolling behavior

2006-10-30 Thread abcd
On Oct 30, 2:52 pm, John Salerno <[EMAIL PROTECTED]> wrote: Don't know for sure, but you can try calling the Refresh() method on the > text control and see if that fixes it. Didn't make a difference. Not sure what the problem is, I am wondering if it is a layout issue since that is my weak spot w

Re: wxPython TextCtrl - weird scrolling behavior

2006-10-30 Thread abcd
> But one question that comes to mind is, do you not add sizerTextPanel to > sizerMainPanel? I think all sub-sizers should be added to the main > sizer, unless there's some weird reason I don't know of. well i set the sizer on the textPanel and then I add the textPanel to sizerMainPanel -- http:

Re: wxPython TextCtrl - weird scrolling behavior

2006-10-30 Thread abcd
On Oct 30, 3:47 pm, John Salerno <[EMAIL PROTECTED]> wrote: >I noticed that one object you refer to is > self.textPane, is that supposed to be self.textPanel? no, self.textPane is the actual wx.TextCtrl. I used a GUI Builder to the layout stuff...perhaps that's my problem :) is there a good site

Re: Python windows interactive.

2006-10-30 Thread abcd
> How do I do sometihing simple like that in python? print "hello" print "Jim" > How do I enter line numbers, or if none, what do I do. no line numbers needed > Can the interpreter load a text file with my program in it? read in a text file: data = open("something.txt").read() > How do I list

Re: wxPython TextCtrl - weird scrolling behavior

2006-11-01 Thread abcd
thanks for the feedback, I am watching the screencasts, which are helping already. I think I will try out the Dabo GUI tool since it uses wxPython...and see if I can get the code I need from it. thanks -- http://mail.python.org/mailman/listinfo/python-list

PythonDoc Ant Task

2006-06-01 Thread abcd
Anyone ever use the PythonDoc ant task? I have the following... ...this is a cut out of the build xml i am using...but it shows the relevant parts. Anyways I can run my "pyDoc" target and it runs successful with no errors. a "docs" directory is created but

Re: PythonDoc Ant Task

2006-06-01 Thread abcd
i found that the problem is because of an import, which is strange. The imported module looks something like this [code] import time class Foo: pass class Bar: global javax.swing import javax.swing [/code] so it seems that pydoc cant giggity-giggit! -- http://mail.python.org/m

Importing again and again

2006-06-08 Thread abcd
If I have code which imports a module over and over again...say each time a function is called, does that cause Python to actually re-import it...or will it skip it once the module has been imported?? for example: def foo(): import bar bar.printStuff() foo() foo() foo() foo() ...will th

Network Ports - blocking / taking over

2006-06-12 Thread abcd
Just curious if anyone had any information, or links, regarding the blocking of network ports and/or taking over (hijacking) ports using Python. Any python modules/libs you could recommend? tutorials/reading materials? Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list

block a network port

2006-08-29 Thread abcd
any ideas on how to block a network port from being used, or one that is currently in use? For example, say I want to block port 23 from being used. by used, I mean allowing connections to or from it. thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list

Re: block a network port

2006-08-29 Thread abcd
Larry Bates wrote: > This is not really a Python question. Blocking ports is a function > of your firewall solution. > ok, no of any python solutions? or command-line firewalls? -- http://mail.python.org/mailman/listinfo/python-list

wxTimer problem

2006-09-15 Thread abcd
I have a python script which creates a wx.App, which creates a wx.Frame (which has a wx.Timer). looks sorta like this: class MyProgram: def __init__(self): self.app = MyApp(0) self.app.MainLoop() class MyApp(wx.App): def OnInit(self): self.myframe= MyFrame()

Re: wxTimer problem

2006-09-15 Thread abcd
> Fix: Start the script from the main thread only. > > Regards, > > > Björn thanks for NO help.anyways, I got rid of the Timer b/c all i was using it for was to check the state of the "shift" key.but I am now binding to key up/down. thanks anyway -- http://mail.python.org/mailman/listi

Extend file type

2006-09-26 Thread abcd
I have a class which extends 'file' class MyFile(file): def __init__(self, fname, mode='r'): file.__init__(self, fname, mode) def write(self, str): print "writing a string" file.write(self, str) def writelines(self, lines): print "writing lines"

More Efficient fnmatch.fnmatch for multiple patterns?

2007-01-08 Thread abcd
I am using fnmatch.fnmatch to find some files. The only problem I have is that it only takes one pattern...so if I want to search using multiple patterns I have to do something like patterns = ['abc*.txt', 'foo*'] for p in patterns: if fnmatch.fnmatch(some_file_name, p): return T

Determine an object is a subclass of another

2007-01-09 Thread abcd
How can tell if an object is a subclass of something else? Imagine... class Thing: pass class Animal: pass class Dog: pass d = Dog() I want to find out that 'd' is a Dog, Animal and Thing. Such as... d is a Dog d is a Animal d is a Thing Thanks -- http://mail.python.org/mailm

Re: Determine an object is a subclass of another

2007-01-09 Thread abcd
yea i meant to have animal extend thing and dog extend animalmy mistake. anyways, is there a way to check without having an instance of the class? such as, isinstance(Dog, (Animal, Thing)) ?? thanks -- http://mail.python.org/mailman/listinfo/python-list

Win32_Process.Create -- not starting process

2006-02-14 Thread abcd
I am using Python to create a process on another computer. Both computers are on the same domain with admin privileges. On computer B I have a batch script which starts a python script. From computer A I am doing the following: import wmi w = wmi.WMI("1.2.3.4") p = w.new("Win32_Process") pid, r

Re: Win32_Process.Create -- not starting process

2006-02-15 Thread abcd
Tim, Ok, well I verified that my python script and batch script are working properly. In fact, if I double click on the batch script (when its on Computer B), it starts the python script and the script runs fine with no problem. However when I try to execute the batch script from computer A

Re: Win32_Process.Create -- not starting process

2006-02-15 Thread abcd
so far i tried adding SET > c:\tmp.txt start SET > c:\tmp2.txt ...and I saw both tmp files created but no python running. I still have to try skipping the batch file...i'll let u know. thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Win32_Process.Create -- not starting process

2006-02-16 Thread abcd
Tim, I am skipping using the batch file and only executing the python script directly...and so far it works fine. So now I have: pid, retVal = wmi.WMI("1.2.3.4").new("Win32_Process").Create(CommandLine="c:\python\python.exe c:\some_script.py") Thanks again...not sure why when using the batch

Re: Win32_Process.Create -- not starting process

2006-02-17 Thread abcd
Tim Golden wrote: > BTW, I would recommend you either to use a raw string > for that command line (r"c:\python\python.exe c:\xx.py") or > to double up your slashes ("c:\\python\\python.exe c:\\xx.py"). > As it happens \p has no special meaning that I'm > aware of, but better safe than sorry... ..

Get parameters from URL using CGI

2006-02-18 Thread abcd
i want to create a CGI script which simply prints out values given via the URL (such as when a GET is performed). So if I have a script named, foo.cgi and I access it by going to: http://www.somesite.com/cgi-bin/foo.cgi?name=john&age=90 I want foo.cgi to print out: name: john age: 90 how d

Re: Get parameters from URL using CGI

2006-02-18 Thread abcd
Ian Leitch wrote: > >>> from urlparse import urlparse > >>> dict([n for n in [i.split('=') for i in > urlparse('http://www.somesite.com/cgi-bin/foo.cgi?name=john&age=90')[4].split('&')]]) > {'age': '90', 'name': 'john'} Ian, thanks for the reply, but that is not what I need to do. Inside foo.cg

Format file size for printing

2006-02-19 Thread abcd
is there a built-in way of printing the size of a file nicely? So if the file size is 103803 bytes it prints out like: 103.8K or 0.1MB something liek that? -- http://mail.python.org/mailman/listinfo/python-list

error: argument after ** must be a dictionary

2006-02-28 Thread abcd
I have class like this... import threading class MyBlah(object): def __init__(self): self.makeThread(self.blah, (4,9)) def blah(self, x, y): print "X and Y:", x, y def makeThread(self, func, args=(), kwargs={}): threading.Thread(target=self.blah, args=args, kw

Re: error: argument after ** must be a dictionary

2006-03-01 Thread abcd
Not sure if it matters, but this occurs when running a unittest. The trace back is: Traceback (most recent call last): File "C:\Python24\Lib\threading.py", line 442, in __bootstrap self.run() File "C:\Python24\Lib\threading.py", line 422, in run self.__target(*self.__args, **self.__kwa

Re: error: argument after ** must be a dictionary

2006-03-01 Thread abcd
i was missing "self" in my method signature! doh! -- http://mail.python.org/mailman/listinfo/python-list

unknown host

2007-06-01 Thread abcd
I have a linux machine (ip = 10.10.10.8), which can ping other machines on the same subnet...such as 10.10.10.1 10.10.10.2 10.10.10.5 10.10.10.6 10.10.10.254 If I use socket.gethostbyaddr() I get back results when ip is 10.10.10.1 and 10.10.10.254 but for the other IP addresses (10.10.10.5, .6, e

regular expression for parsing an html element

2007-04-20 Thread abcd
I have some HTML such as blah blah blah I wnat to pull out the text that lies inside the quotes of the src attribute. So in this example I would get image/blah/a.jpg My regex so far is: src=\"(.*)\" however the group in this case would end up being, image/blah/a.jpg" id="d">bla

Re: regular expression for parsing an html element

2007-04-20 Thread abcd
thanks, forgot that. -- http://mail.python.org/mailman/listinfo/python-list

Re: pyHook or SetWindowsHookEx

2007-03-02 Thread abcd
:( -- http://mail.python.org/mailman/listinfo/python-list

Are Lists thread safe?

2007-03-09 Thread abcd
Are lists thread safe? Or do I have to use a Lock when modifying the list (adding, removing, etc)? Can you point me to some documentation on this? thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Are Lists thread safe?

2007-03-09 Thread abcd
Thanks for the link. I saw that one in my google search but didn't visit it for some reason. Looks like most operations should be just fine. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Are Lists thread safe?

2007-03-09 Thread abcd
I guess this might be overkill then... class MyList(list): def __init__(self): self.l = threading.Lock() def append(self, val): try: self.l.acquire() list.append(self, val) finally: if self.l.locked(): self.l.rele

Re: Are Lists thread safe?

2007-03-09 Thread abcd
On Mar 9, 2:50 pm, "abcd" <[EMAIL PROTECTED]> wrote: > I guess this might be overkill then... > > class MyList(list): > def __init__(self): > self.l = threading.Lock() > > def append(self, val): > try: > self.l.ac

Re: How to Start a (thread?) and Leave

2007-03-09 Thread abcd
probably a Thread. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to Start a (thread?) and Leave

2007-03-09 Thread abcd
> But a thread leaves the script running until the thread exits, right? > So the webpage would just keep saying "loading" at the bottom I think. > > -Greg give it a shot. if you spawn off a new thread your code should keep executing while the thread does its work in the "background". -- http://

Quick Filter Dictionary

2007-03-14 Thread abcd
Hi, I have a dictionary which may contain various keys/values, however, it will always contain 'name' and 'age' keys. This dictionary is kept inside a class, such as class Person: def __init__(self, name, age): self.data = {'name' : name, 'age' : age} de

Re: Quick Filter Dictionary

2007-03-14 Thread abcd
On Mar 14, 7:29 am, "abcd" <[EMAIL PROTECTED]> wrote: > Hi, >I have a dictionary which may contain various keys/values, however, > it will always contain 'name' and 'age' keys. > >This dictionary is kept inside a class, such as >

wxTextCtrl - copy and paste 65, 000 characters of text into it only seems to hold 30, 003

2007-03-15 Thread abcd
I have a wxTextCtrl: wx.TextCtrl(self.myPanel, -1, "", style=wx.TE_MULTILINE) I take a set of text (65,000 characters), and paste it into the text control. all looks well. Then when I click a button I print out the entered text and the length of that text. Here is what I am seeing... 1. Paste

Multiline code - trailing slash usage

2007-03-15 Thread abcd
When do I need to use a trailing slash to separate code over multiple lines. For example: x = "hello world, this is my multiline " + \ "string" x = {'name' : \ 'bob'} Do I need to use the "\" in the above examples? When do i need to use it? -- http://mail.python.org/mailman/li

Load three different modules which have the same name

2007-03-19 Thread abcd
I have the following directory structure setup... c:\alpha\Person.py -- class Person(IPerson): def __init__(self): print "Alpha person here" c:\beta\Person.py -- class Person(IPerson): def __init__(self): print "Beta person here" c:\gamma\P

Re: Load three different modules which have the same name

2007-03-19 Thread abcd
nevermind this took care of it: import sys def tryAllThree(): a = "c:\\alpha" b = "c:\\beta" g = "c:\\gamma" sys.path.append(a) import Person alpha = Person.Person() sys.path.remove(a) sys.path.append(b) reload(Person) beta = Person.Person() sys.path

Re: Load three different modules which have the same name

2007-03-20 Thread abcd
> Blerch! Why not just call the modules by the right names in the first > place? Then each will have its own sys.modules entry for a start ... > > regards > Steve what do i need to do? also, is there a way I can load each one as I have but each one have its own unique entry in sys.modules? For

Re: Load three different modules which have the same name

2007-03-20 Thread abcd
thanks for the help. -- http://mail.python.org/mailman/listinfo/python-list

help - Module needs access to another module

2007-03-20 Thread abcd
I have the following directory/file structure... c:\foo\utils.py c:\foo\bar\ok.py In ok.py I want to do something like... import utils utils.helpMeDoSomething() However, it seems that ok.py doesn't "know" about utils. Other than manually configuring sys.path what can I do? thanks -- htt

Re: help - Module needs access to another module

2007-03-20 Thread abcd
On Mar 20, 9:58 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > After a bunch of questions of that kind, I suggest you take a step back, and > read this: > > http://docs.python.org/tut/node8.html got it, thanks. -- http://mail.python.org/mailman/listinfo/python-list

Make variable global

2007-03-21 Thread abcd
I have a file, "a.py" blah = None def go(): global blah blah = 5 >From the python interpreter I try >>> from a import * >>> blah >>> go() >>> blah >>> ...i was hoping to see "5" get printed out the second time I displayed blah, but it doesn't. Now, if I type this same code directly

Question about extending tuple

2007-03-28 Thread abcd
I wanted to extend tuple but ran into a problem. Here is what I thought would work class MyTuple(tuple): def __init__(self, *args): tuple.__init__(self, args) x = MyTuple(1,2,3,4) That gives me... TypeError: tuple() takes at most 1 argument (4 given). However, this call works: x

Re: Question about extending tuple

2007-03-28 Thread abcd
> As an immutable type, tuple makes use of __new__. > > class MyTuple(tuple): > def __new__(cls, *args): > return tuple.__new__(cls, args) > > should work. > > Georg strange. not very consistent. -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about extending tuple

2007-03-29 Thread abcd
> > I hope you see now why it is consistent. > > Georg yea that clears it up. thanks. -- http://mail.python.org/mailman/listinfo/python-list

Retrieve an item from a dictionary using an arbitrary object as the key

2007-04-03 Thread abcd
Hi, I have a class such as, class Type: def __init__(self, val): self.val = val class Person: def __init__(self, name, age): self.name = name self.age = age So I have a dictionary which maps an instance of Type to an instance of Person. Now I need to retrieve

Re: Retrieve an item from a dictionary using an arbitrary object as the key

2007-04-03 Thread abcd
> You'll need __eq__ for testing if two objects are equivalent, and > __hash__ for calculating object's hash value. > > class Type: > def __init__(self, val): > self.val = val > > def __eq__(self, other): > return self.val == other.val > > def __hash__(self): > r

wrap_EncryptByteArray argument 1 must be string without null bytes, not str

2007-04-12 Thread abcd
Has anyone seen this error before: wrap_EncryptByteArray() argument 1 must be string without null bytes, not str I am having a hard time finding anything about it. -- http://mail.python.org/mailman/listinfo/python-list

Search Queue

2007-01-16 Thread abcd
I have a class such as... id = 0 class Foo: def __init__(self, data): self.id = id id += 1 self.data = data And I am storing them in a Queue.Queue... import Queue q = Queue.Queue() q.put(Foo('blah')) q.put(Foo('hello world')) q.put(Foo('test')) how can I search "q" f

Re: Search Queue

2007-01-16 Thread abcd
Yea basically I need Queue like functionality with the ability to search for a particular instance in it. I guess I could just use a list and search it as needed. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Thoughts on using isinstance

2007-01-24 Thread abcd
In my code I am debating whether or not to validate the types of data being passed to my functions. For example def sayHello(self, name): if not name: rasie "name can't be null" if not isinstance(name, str): raise "name must be a string" print "Hello " + name Is the u

Re: Thoughts on using isinstance

2007-01-24 Thread abcd
> The "Python way" is to validate by performing the operations you need to > perform and catching any exceptions that result. In the case of your > example, you seem to be saying that you'd rather raise your own > exception (which, by the way, should really be a subclass of Exception, > but we will

Re: Thoughts on using isinstance

2007-01-24 Thread abcd
Well my example function was simply taking a string and printing, but most of my cases would be expecting a list, dictionary or some other custom object. Still propose not to validate the type of data being passed in? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Thoughts on using isinstance

2007-01-24 Thread abcd
Well my example function was simply taking a string and printing, but most of my cases would be expecting a list, dictionary or some other custom object. Still propose not to validate the type of data being passed in? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Thoughts on using isinstance

2007-01-24 Thread abcd
>Yes because usually you don't expect a list or dictionary but some object > that *acts* like a list or dictionary. Or you even expect just some > aspects of the type's behavior. For example that it is something you can > iterate over. > > Ciao, > Marc 'BlackJack' Rintsch good point. is

marshal.loads ValueError

2007-01-31 Thread abcd
I have the following code which is sent over the wire as a string... from time import time class Foo: def go(self): print "Time:", time() I get this code and store it as, "data" data = receivePythonSource() Then I try... exec marshal.loads(data) in my_module.__dict__ However I ge

Re: marshal.loads ValueError

2007-01-31 Thread abcd
On Jan 31, 8:02 am, Benjamin Niemann <[EMAIL PROTECTED]> wrote: > marshal is used to (de)serialize python objects from/to strings. > marshal.loads() tries to deserialize an encoded string back into a python > object - which does not make sense here. > What you probably want is: > > exec data in my_

pyHook or SetWindowsHookEx

2007-02-27 Thread abcd
I am having trouble with pyHook on python 2.4.1. Basically I have a python app that uses pyHook to capture keyboard events and write them straight to a file. The application is running as a service on a windows machine. If I am at that windows machine the application works just fine, logging my

Re: book for a starter

2007-02-27 Thread abcd
I'd pick, Dive Into Python (http://www.diveintopython.org/) you can read it online for FREE! -- http://mail.python.org/mailman/listinfo/python-list

Re: pyHook or SetWindowsHookEx

2007-02-28 Thread abcd
anyone? -- http://mail.python.org/mailman/listinfo/python-list

Capture key strokes

2007-03-01 Thread abcd
Is there a way to capture key strokes on a system using python (other than pyHook)? can wxPython capture keystrokes for the system (not just, say a text box)? thanks -- http://mail.python.org/mailman/listinfo/python-list

Jython: exec a string

2006-04-21 Thread abcd
I have a single jython file, foo.py which contains multiple classes. I read that into a string and try to exec itbut I get errors saying something like unable to load class. It seems to work fine if foo.py only contains a single class, any ideas? -- http://mail.python.org/mailman/listinfo/p

Re: Jython: exec a string

2006-04-21 Thread abcd
the error i get when i run the exec is, "java.lang.ClassFormatError"... thanks -- http://mail.python.org/mailman/listinfo/python-list

Add file to zip, or replace file in zip

2006-04-28 Thread abcd
I have a script which zips up a directory, once it does with that (before it closes the zip file) I want to replace a file that was added to the zip, say "Foo.txt". So I tried this... [code] z = zipfile.ZipFile("blah.zip", "w") # zip the directory #... z.writestr("c:\\path\\to\\current\\foo_txt_fi

u just click u get some dollars

2008-07-25 Thread abcd
http://www.parttimejobsu.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

PyCon2006 - will the content be available for download?

2006-03-08 Thread abcd
Anyone know if (and when) the talks from PyCon2006 will be available for download. I am particularly interested in the tutorials (as they did not have them at PyCono2005). Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: PyCon2006 - will the content be available for download?

2006-03-08 Thread abcd
Max M wrote: > http://us.pycon.org/AudioVideoRecording/HomePage Thanks, after going to the URL, I clicked "talks" and got to http://us.pycon.org/talks ...this page lets u pick which talks you want to access. thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: PyCon2006 - will the content be available for download?

2006-03-08 Thread abcd
well actually, the site looked promising...only problem is no talks have audio, video or handouts available (at least right now). oh well. -- http://mail.python.org/mailman/listinfo/python-list

pythoncom.PumpMessages - how to quit

2006-03-09 Thread abcd
When I call: pythoncom.PumpMessages() ...it blocks at that line. According to the docs, it says it will run until it receives a WM_QUITso I try to create a separate thread and do import win32api win32api.PostQuitMessage() ...but the code is still blocking at PumpMessages. Any ideas? othe

pythoncom.PumpMessages - how to quit

2006-03-09 Thread abcd
When I call: pythoncom.PumpMessages() ...it blocks at that line. According to the docs, it says it will run until it receives a WM_QUITso I try to create a separate thread and do import win32api win32api.PostQuitMessage() ...but the code is still blocking at PumpMessages. Any ideas? othe

pysqlite

2006-03-27 Thread abcd
anyone have v2.x of pysqlite that I could download? the website is down for a hardware upgrade with no date as to when it will be back. I checked sourceforge but there are no files there to download. thanks. -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >