Skip to content

Tag: python

Porting my PyGtk 3 app to Win32

I recently made my first app with pygtk using Anjuta. It works well under Linux, so it’s time to share it with relatives and friends. I installed Python, pygtk and the Gtk all-in-one bundle (Cairo, pyGobject ect) on windows and tried to run it. I had an error saying self.builder.add_from_file(UI_FILE) D…

Python: Print next x lines from text file when hitting string

The situation is as follows: I have a .txt file with results of several nslookups. I want to loop tru the file and everytime it hits the string “Non-authoritative answer:” the scripts has to print the following 8 lines from that position. If it works I shoud get all the positive results in my scre…

Determine Device of Filesystem in Python

How do you use Python to determine which Linux device/partition contains a given filesystem? e.g. Answer It is not the purdiest, but this will get you started: On OS X: On Ubuntu: To get the device name, chop off the minor number from the partition name. On OS X, also chop the ‘s’ + minor number.