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: 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? Thanks, Fabian Check out os.path.walk. Thanks

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:

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 to send ICMP packets. However, I don't know what

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

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 -- http://mail.python.org/mailman

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 expressions but I would like to avoid them

Re: Splitting device addresses into parts

2006-09-26 Thread Fabian Steiner
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

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

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

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 it

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).

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 achieve

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

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 = seqlen; i++) { Should be for (i = 0; i seqlen; i++) {. Otherwise the last

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 is a PyObject*. You'll have to convert it to an integer now

Re: Printing a file

2006-03-02 Thread Fabian Steiner
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
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

Printing a file

2006-02-28 Thread Fabian Steiner
the template have? (XML, etc.?) Any hints appreciated! Cheers, 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 :-) Cheers,

PyQT: QDialog and QMainWindow interacting with each other

2006-02-27 Thread Fabian Steiner
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
to 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 --