Re: chmod directories recursively

2007-07-17 Thread Fabian Steiner
Jennifer Thacher wrote: > Fabian Steiner wrote: >> As far as I can see os.chmod() doesn't adjust permissions on directories >> recusively. Is there any other possibility to achieve this aim except for >> calling os.system('chmod -R /dir') directly? >

chmod directories recursively

2007-07-17 Thread Fabian Steiner
Hello! As far as I can see os.chmod() doesn't adjust permissions on directories recusively. Is there any other possibility to achieve this aim except for calling os.system('chmod -R /dir') directly? Thanks, Fabian -- http://mail.python.org/mailman/listinfo/python-list

Re: How to test whether a host is reachable?

2007-02-22 Thread Fabian Steiner
Hello! Chris Mellon wrote: > On 2/22/07, Fabian Steiner <[EMAIL PROTECTED]> wrote: >> [...] >> Now I am wondering if there isn't any better method which would be more >> general. In fact, I think of something like a python version of ping >> which only tries

How to test whether a host is reachable?

2007-02-22 Thread Fabian Steiner
Hello! As the subject says I need to test whether a host computer in our network is reachable or not. At the moment I simply attempt to connect to a given port that is open when the machine is online: [...] sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: sock.connect(('192.16

Flushing standard input

2006-10-18 Thread Fabian Steiner
Recently I came across a problem which I still can't solve on my own. Consider this small example: import sys import time time.sleep(3) print sys.stdin.flush() input = raw_input('Your input: ') print 'Your input: ', input While the script is sleeping I type in the word 'test1', so that it is pri

Re: Splitting device addresses into parts

2006-09-26 Thread Fabian Steiner
int the rest. > Alternatively, if the delimiters can really be anything, and if there > are no numbers in the first space ("PCI"), then maybe this approach: Thank you, this solution seems to be quite satisfying :-) Regards, Fabian Steiner -- http://mail.python.org/mailman/listinfo/python-list

Re: Splitting device addresses into parts

2006-09-26 Thread Fabian Steiner
Bruno Desthuilliers wrote: > Fabian Steiner wrote: >> I often have to deal with strings like "PCI:2:3.0" or "PCI:3.4:0" and >> need the single numbers as tuple (2, 3, 0) or (3, 4, 0). Is there any >> simple way to achieve this? So far I am using regular

Splitting device addresses into parts

2006-09-26 Thread Fabian Steiner
I often have to deal with strings like "PCI:2:3.0" or "PCI:3.4:0" and need the single numbers as tuple (2, 3, 0) or (3, 4, 0). Is there any simple way to achieve this? So far I am using regular expressions but I would like to avoid them ... Regards, Fabian Steiner -- ht

Recursive function returning a list

2006-07-17 Thread Fabian Steiner
Hello! I have got a Python "Device" Object which has got a attribute (list) called children which my contain several other "Device" objects. I implemented it this way in order to achieve a kind of parent/child relationship. Now I would like to get all children of a given "Device" object and t

Starting a GUI application out of an console application

2006-07-17 Thread Fabian Steiner
Hello! I am currently working on an alternative for the gnome-volume-manager for multiseat systems based on HAL and DBus. Whenever the signal 'DeviceAdded' is received I would like to start a GUI-Interface where the user can choose from different options. But now I am wondering how I should st

Re: hidden file detection

2006-05-20 Thread Fabian Steiner
Lenny G. wrote: > What's the best way to do cross-platform hidden file detection? I want > to do something like weed-out the files that should be 'hidden' from > os.listdir() (which would be files that start with '.' under Unix, > files that have the hidden attribute set on windows, and whatever i

twisted.web and a

2006-04-10 Thread Fabian Steiner
Hello! I am currently working on a quite complicated application (at least for me) and unfortunately I don't know how to go on. I wrapped a Windows-dll by using the ctypes module so that I can access different functions that are used to control a network device (open, close, write/read values). N

Creating an event loop

2006-04-09 Thread Fabian Steiner
Hello! I am currently wondering how to write something like an "event loop". For example, if I want to write a function that checks whether a file was added or removed in a directory I would think of a "while 1: ..." construct that checks the mtime of the directory. Is this the right way to achiev

Re: C-API: A beginner's problem

2006-03-19 Thread Fabian Steiner
Georg Brandl wrote: > Fabian Steiner wrote: >> [...] >> for (i = 0; i <= seqlen; i++) { > > That is one iteration too much. Use > > for (i = 0; i < seglen; i++) > >> item = PySequence_Fast_GET_ITEM(seq, i); > > Now item

Re: C-API: A beginner's problem

2006-03-19 Thread Fabian Steiner
Heikki Salo wrote: > Heikki Salo wrote: >> Fabian Steiner wrote: >>> What did I do wrong? As I am quite new to C, I probably made many >>> mistakes, so please feel free to correct me. >> >> The following line: >> >> > for (i = 0; i <=

C-API: A beginner's problem

2006-03-19 Thread Fabian Steiner
I recently started learning C since I want to be able to write Python extension modules. In fact, there is no need for it, but I simply want to try something new ... I tried to implement the bubblesort algorithm in C and to use it in python; bubblesort.c compiles fine, but whenever I want to im

Re: Printing a file

2006-03-02 Thread Fabian Steiner
ere with which I can write those special HTML files? I am quite familiar with HTML and CSS but I don't want to waste my time with that. Regards, Fabian Steiner -- http://mail.python.org/mailman/listinfo/python-list

Re: Printing a file

2006-03-01 Thread Fabian Steiner
sk myself whether it is necessary that in order to write text on the paper, I always have to pass the proper x, y values to QPainter.drawText(). Isn't there any other possibility? How do I get these values? Thanks in advance, Fabian Steiner -- http://mail.python.org/mailman/listinfo/python-list

Re: PyQT: QDialog and QMainWindow interacting with each other

2006-02-28 Thread Fabian Steiner
Hi Kai! Kai Teuber wrote: > Hi Fabian, > > override the accept() method and call self.showListViewItems() there. > But remember to call QDialog.accept() at the end. > > def accept( self ): > self.showListViewItems() > QDialog.accept( self ) Thank you very much, I got it working :-)

Printing a file

2006-02-28 Thread Fabian Steiner
gest? Which format should the template have? (XML, etc.?) Any hints appreciated! Cheers, Fabian Steiner -- http://mail.python.org/mailman/listinfo/python-list

PyQT: QDialog and QMainWindow interacting with each other

2006-02-27 Thread Fabian Steiner
sed? Thank you for any input! Cheers, Fabian Steiner -- http://mail.python.org/mailman/listinfo/python-list

PyQt and Threading to update a dialog?

2006-02-20 Thread Fabian Steiner
achieve this aim, but so far I didn't succeed in doing it because I couldn't find any examples. Could anyone give me some hints or a piece of code? Cheers, Fabian Steiner -- http://mail.python.org/mailman/listinfo/python-list

Re: PyQt: QListView how to retrieve selected items?

2006-02-02 Thread Fabian Steiner
Hi! Sorry for adopting your post for my own question, but since it is related to PyQT I think it's ok: Does anybody of you know where the openbook »GUI Programming with Python: QT Edition« has gone? It's not available any more: http://www.opendocs.org/pyqt/ points now to a non-existing site.

General Type Checks (int, str, tuple, etc.)

2006-01-28 Thread Fabian Steiner
Hello! So far, I am using something like »if isinstance(var, int):« to determine, whether var's value is an integer. Now I would like to know if there is any better possibility to do such general checks or may a construct with isinstance() even fail in certain cases? Cheers, Fabian -- http://