Re: pipes python cgi and gnupg

2008-01-08 Thread alisonken1
On Dec 28 2007, 7:07 pm, [EMAIL PROTECTED] wrote: snip form = cgi.FieldStorage() if not form.has_key(pass): print Enter password filename = test.gpg pass = form.getvalue(pass).strip() os.system(gpg --version gpg.out) os.system(echo %s | gpg --batch --password-fd 0 --decrypt %s d.out

Re: Layer 2 socket connection

2007-08-16 Thread alisonken1
On Aug 16, 5:03 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: snip I use impacket for stuff like that, seehttp://oss.coresecurity.com/projects/impacket.html Cheers Rich. Thanks, Rich - I'll have a look -- http://mail.python.org/mailman/listinfo/python-list

Layer 2 socket connection

2007-08-15 Thread alisonken1
Hello all - I'm looking at trying to write a python script to connect to a layer 2 bridge (no IP available). Looking at the sockets function, it's not clear if I can connect using only the mac address - it appears to want either a broadcast address or a specific IP address. Can anyone give me a

Re: Layer 2 socket connection

2007-08-15 Thread alisonken1
On Aug 15, 12:05 pm, Martin v. Löwis snip If your operating system supports the PF_PACKET protocol family, you can try to use that. Python only wraps the socket interface of the operating system, so if the system's socket implementation has no facility for that, Python cannot expose it to you,

Re: if __name__ == 'main': passing an arg to a class object

2007-04-27 Thread alisonken1
On Apr 27, 2:08 pm, gtb [EMAIL PROTECTED] wrote: The lines if __name__ == 'main': someClass().fn() appear at the end of many examples I see. Is this to cause a .class file to be generated? These are samples to give the programmer an idea of how the code is supposed to work. If you

Re: how to create/ref globals in an alternate namespace?

2007-04-27 Thread alisonken1
On Apr 27, 2:33 pm, Steven W. Orr [EMAIL PROTECTED] wrote: On Friday, Apr 27th 2007 at 14:07 -0700, quoth James Stroud: snip I'm trying to see if by being clever, I can factor out the common code of the four different functions and still end up with what they create ending up in the

Re: Been a while...

2007-03-22 Thread alisonken1
On Mar 22, 11:48 am, John Salerno [EMAIL PROTECTED] wrote: snip http://www.pythonchallenge.com Ugh, I gave up on that site a long time ago! :) I got stuck on 34 a couple of months ago and haven't had time to go back to it. Fun challenge. --

Re: Parsing Indented Text (like parsing Python)

2007-03-13 Thread alisonken1
On Mar 11, 2:34 am, Mike Schinkel [EMAIL PROTECTED] wrote: Hi, I'm relatively new to Python but have lots of prior programming experience as a developer, instructor, and author (ASP/VBScript/SQL Server and Clipper.) snip -- -Mike

Re: Nested if and expected an indent block

2006-08-13 Thread alisonken1
[EMAIL PROTECTED] wrote: Greetings: snip elif q.lower() == some# s in some is highlighted snip Any ideas? Thanks in advance. Keith Would the missing colon have something to do with it? elif q.lower() == some: -- http://mail.python.org/mailman/listinfo/python-list

Re: String Formatting

2006-08-10 Thread alisonken1
OriginalBrownster wrote: snip Example If i had a list:bread, butter, milk def get_word(s, which=1, sep=','): return s.split(sep)[which-1].strip() get_word('bread, butter, milk') 'milk' -- http://mail.python.org/mailman/listinfo/python-list

Re: String Formatting

2006-08-10 Thread alisonken1
alisonken1 wrote: OriginalBrownster wrote: snip Example sorry, forgot the '... everything after the last comma ...' part. -- http://mail.python.org/mailman/listinfo/python-list

Re: String Formatting

2006-08-10 Thread alisonken1
Sorry, missed an option in there: def get_word(s, which=1, sep=','): return s.split(sep)[which-1].strip() get_word('bread, butter, milk') 'milk' get_word('bread, butter, milk') 'bread' get_word('bread, butter, milk', 3) 'milk' get_word('bread is brown, butter is yellow, milk

Re: simple dbus python problem ... please help

2006-07-29 Thread alisonken1
bob wrote: snip bus = dbus.Bus (dbus.Bus.TYPE_SYSTEM) hal_service = bus.get_service ('org.freedesktop.Hal') hal_manager = hal_service.get_object ('/org/freedesktop/Hal/Manager', 'org.freedesktop.Hal.Manager') snip It appears that bus.get_service() has

Re: stderr, stdout, and errno 24

2006-07-13 Thread alisonken1
Wesley Henwood wrote: I've checked and double checked my code and I am closing all files explicitly after opening them. The only possibliy I can think of is Python opening files each time I run a script, or each time imput to stderr or stdout is redirected. snip The problem I think is that

Re: Duplex communication with pipes - is possible ?

2006-06-16 Thread alisonken1
snip readlines () will try to read until the stream/socket is closed. Try to read only one line. This of course means that you cannot sent \n as part of the data, you have to escape them somehow. snip If I remember correctly, if you want to pass '\n' so readline won't stop, you should be

Re: ValueError: too many values to unpack

2006-06-08 Thread alisonken1
[EMAIL PROTECTED] wrote: snip 56 records were different Type, FileType, Item, Hash, Path, Size, CullCd, Ext, DtCr, DtLMd, DtLAc Traceback (most recent call last):

Re: find all index positions

2006-05-11 Thread alisonken1
[EMAIL PROTECTED] wrote: hi say i have string like this astring = 'abcd efgd 1234 fsdf gfds abcde 1234' if i want to find which postion is 1234, how can i achieve this...? i want to use index() but it only give me the first occurence. I want to know the positions of both 1234 thanks

Re: find all index positions

2006-05-11 Thread alisonken1
Scott David Daniels wrote: [EMAIL PROTECTED] wrote: SNIP print list(positions('1234', 'abcd efgd 1234 fsdf gfds abcde 1234')) prints: [10, 31] Nicer than mine ;) Shows I need to get a job where I use python more! -- http://mail.python.org/mailman/listinfo/python-list

Re: Logging vs printing

2006-05-08 Thread alisonken1
Leo Breebaart wrote: SNIP Also, assume that I have set it up as above. Now I want certain other print statements to go to sys.stderr alone. If I understand the docs correctly (possibly I don't), the way to do this is to start attaching explicit StreamHandlers and whatnot. Whereas with

Re: Passing options around your program

2006-05-07 Thread alisonken1
Leo Breebaart wrote: I have another question where I am not so much looking for a solution but rather hoping to get some feedback on *which* solutions people here consider good Pythonic ways to approach a issue. The situation is this: I am writing fairly large console scripts in Python.

Re: Drop Down Menus...

2006-05-05 Thread alisonken1
Hello Bruce - bruce wrote: Hi... Never used python, but I have a question regarding Drop Down Menus. Does Python allow me to create a website, that will permit the user to create Drop Down menus that can be initiated with the right mouse click? If it can, is it fairly easy to implement?

Re: ConfigParser and multiple option names

2006-05-02 Thread alisonken1
Benji York wrote: SNIP I generally do this: dirs = /home/florian /home/john /home/whoever ...and then use str.split() in my program. -- Benji York The only problem with this would be if you plan on updating the config file later in the program - I don't think

Re: What do you use __init__.py for?

2006-04-27 Thread alisonken1
[EMAIL PROTECTED] wrote: snip But what other uses does the '__init__.py' script have? What do you use it for? snip __init__.py is used for initialization of the package - similar to __init__() in a function or class declaration. One example would be if you create a package with generic

Re: Advanced Treeview Filtering Help

2006-04-27 Thread alisonken1
Your question was answered on PyGTK mailing list. Please, don't crosspost. Where is the pygtk mailing list? -- http://mail.python.org/mailman/listinfo/python-list

Re: error

2006-04-24 Thread alisonken1
Will I get the same error running main if the total number of lines in the smaller modules is 10k? Not sure if this would solve your problem, but I noticed the 10K filesize. I don't know about other programmers, but I find it much easier to keep track of stuff if I keep the individual file

Re: How should multiple (related) projects be arranged (structured) and configured so that they can share code, have a related package structure and enable proper unittesting, and ensuring no namespac

2006-04-21 Thread alisonken1
It can be fun when talking several subjects in the same post g. In this case, it was just a matter of thinking about what the main question was about unit testing code that also required other production packages, but with the caveats that he didn't want to duplicate packages just to test code or

Re: Raising a specific OSError

2006-04-21 Thread alisonken1
To raise a specific error, just find the error that you want to raise, then give the error a text string to print: ex. raise IOError(This raises an IO error) On the stderr output, when the routine hits this line, you will get: raise IOError(This raises an IOError) Traceback (most recent call

Re: Pythonesque interface.

2006-04-21 Thread alisonken1
OP = Original Poster -- http://mail.python.org/mailman/listinfo/python-list

Re: How should multiple (related) projects be arranged (structured) and configured so that they can share code, have a related package structure and enable proper unittesting, and ensuring no namespac

2006-04-20 Thread alisonken1
I believe that Paddy was referencing his second point about keeping production code and test code clearly delimited, so was recommending that a version control system be used rather than the local disk structure required by python for building module packages. Although, I have found that symlinks

Re: How should multiple (related) projects be arranged (structured) and configured so that they can share code, have a related package structure and enable proper unittesting, and ensuring no namespac

2006-04-20 Thread alisonken1
Not sure about vcs - but cvs can be more fun if the hard disk dies {g}. -- http://mail.python.org/mailman/listinfo/python-list

Re: How should multiple (related) projects be arranged (structured) and configured so that they can share code, have a related package structure and enable proper unittesting, and ensuring no namespac

2006-04-20 Thread alisonken1
As to the question fail to see how version control relates to code/test separation, the original poster asked several questions, one of which was production/testing code separation. Along with the separation (so while you're testing new functionality, you don't break production files), a

Re: indirect import of standard module

2006-04-18 Thread alisonken1
Unless you override some of os.* functions in foo, you want to import os into foo and bar separately. Python does not reimport the module a second time (create a second instance of os), it only creates a pointer to the first instance that's loaded. --

Re: indirect import of standard module

2006-04-18 Thread alisonken1
Actually, it does not execute the code only the first time, more accurately, it initializes the code only the first time. But you are correct, it exposes the os.* module into the current namespace so you don't have to go to convoluted lengths to get to it. --

Re: indirect import of standard module

2006-04-18 Thread alisonken1
Although 'namespace' may be a misnomer, module interfaces are 'exposed' to the module that imports it - it's not imported a second time into the new 'namespace'. The confusion comes about thinking that modules and classes are related. When a module is first imported, an instance is created for