[Tutor] Detecting my own IP address?

2005-06-05 Thread Simon Gerber
G'day, I'm currently blundering through a script that will let me configure and then connect to PPTP VPNs from a Linux box. Just a text-based front-end to pptp-client, really. Adding in new VPN configurations was simple. Connecting is a little harder. From the command-line I would normally typ

Re: [Tutor] Detecting my own IP address?

2005-06-05 Thread Simon Gerber
Thank you for your suggestions everyone. I do wish to parse ifconfig, as I'm specifically after the address of ppp0. At this stage, I'm only writing the script for my own machine, so the downside to parsing ifconfig does not yet apply. I'm a little curious, however. When you say 'varies depending

[Tutor] "Print" behaviour inside a loop?

2005-06-11 Thread Simon Gerber
Hullo, Firstly, thanks to everyone who helped me find my own IP address. That was a big help. That bit is working now, and working very nicely. I am now stuck on something purely aesthetic - printing a few dots across the screen to provide a bit of feedback while the VPN tunnel is being establ

Re: [Tutor] "Print" behaviour inside a loop?

2005-06-12 Thread Simon Gerber
share. Regards, -- "Come back to the workshop and dance cosmological models with me?" - Peer, "Permutation City", by Greg Egan. Simon Gerber [EMAIL PROTECTED] ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] how do i pause a script ?

2005-06-22 Thread Simon Gerber
better way, feel free to correct me. I've only just started to learn Python myself. -- "Come back to the workshop and dance cosmological models with me?" - Peer, "Permutation City", by Greg Egan. Simon Gerber [EMAIL PROTECTED] ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] PyGTK, classes and return values?

2005-08-13 Thread Simon Gerber
ny way to return it. Nor can I successfully pass anything in by reference, change it into the required class, and pass it out again. Any help would be much appreciated. Regards, -- "Come back to the workshop and dance cosmological models with me?" - Peer, "Permutation City&qu

Re: [Tutor] Replacement for 'Find' Module

2005-08-15 Thread Simon Gerber
You could probably do something like this... (Note: This example is for Linux - but you can adapt it fairly easily to Windows.) # E.g. Find every .inf file on a CD-ROM. path = '/cdrom' # 'E:\\' or whatever for Windows inf_list = [] for root, dirs, files in os.walk(path): for current_fi

Re: [Tutor] How can I make this run right?

2005-08-15 Thread Simon Gerber
I'd do it like this... And there's probably an even quicker way, if you really sat down and thought about it. n = int(raw_input("Number: ")) x = n-1 while x > 1: n *=x x -=1 print n The reason why it isn't working is because of " while x > 1: x -= 1 " When your program hits this p

Re: [Tutor] OT - Newbie Anxiety

2005-11-10 Thread Simon Gerber
side from that, thanks for the interested read. Cheers! -- Simon Gerber - Prodigi Solutions http://www.prodigi.com.au ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] FWD: How do I fix this error so that my exchange rates program will work?

2005-12-14 Thread Simon Gerber
Sorry - Forgot to reply to the list as well. -- Forwarded message -- Hi Nathan, Let's take a look at the debugger message: > Traceback (most recent call last): > File "D:\Python24\exchange.py", line 84, in -toplevel- > save_rates(rates) > File "D:\Python24\exchange.py",

Re: [Tutor] Guess my number game

2005-12-15 Thread Simon Gerber
Hi William, Just a word of warning, you should get used to using 'raw_input()' rather than 'input()' in your progams. Why? Because input() attempts to run whatever you type in as a Python program. If you want to know why that's a problem, try running your progam. When it asks you to "Enter the nu

Re: [Tutor] How do I fix this IndexError?

2005-12-20 Thread Simon Gerber
Hi Nathan, > Traceback (most recent call last): > File "D:\Python24\exchange.py", line 28, in -toplevel- > exch = pickle.load(store) > File "D:\Python24\lib\pickle.py", line 1390, in load > return Unpickler(file).load() > File "D:\Python24\lib\pickle.py", line 872, in load > disp

Re: [Tutor] How do I fix this IndexError?

2005-12-20 Thread Simon Gerber
Hi Nathan, I've attached a crude hack that fixes the problem. It should give you an idea of how to proceed. I've put comments next to the things I've changed. Bear in mind I'm hardly more than a beginner myself, so there are definitely better ways to do this. But it's somewhere to start, anyway.

Re: [Tutor] new to linux and I cannot find some python things

2005-12-28 Thread Simon Gerber
> Hi all, > > I'm a week or so into having switched from WinXP to linux (ubuntu > breezy). There is a lot to learn about the differences in the OS'es > and that's just fine. Excellent! Another Ubuntu Breezy user here. If there's anything Ubuntu I can help you with, drop me an e-mail and I'll do wh

[Tutor] Finding bottom level directories, and command-line arguments

2006-02-07 Thread Simon Gerber
G'day Tutors, I watch many different TV shows on my PC, as many of us do. But I am sick and tired of forgetting which episode I was up to. So, in a prodigious effort to avoid ever using, say, a pen, I am working on a script to take over some of my brain's memory handling. When complete, I will si

Re: [Tutor] Finding bottom level directories, and command-line arguments

2006-02-07 Thread Simon Gerber
Hi Danny, Thanks for the advice. > It might be interesting to write a function that takes an arbitrary > directory, and returns 'True' if that directory is a bottom-level > directory. Can you write this function? I've got this: --- def isBottomDir(path): for item in os.listdir(path):

Re: [Tutor] Finding bottom level directories, and command-line arguments

2006-02-08 Thread Simon Gerber
Hi Danny, > That web site (http://thedailywtf.com) is amusing in its way, but my > problem with it is that so many of the people there enjoy mocking others > in a mean-spirited and immature way. Programming well is a hard thing. > The adolescent posturing I see there isn't admirable to me. It's a

Re: [Tutor] [OT] Shells

2006-03-07 Thread Simon Gerber
> It looks promising, although without good command line editing and the > ability to create active GUIs it will be limited. But then, you can't do GUIs > in > bash either... There's always Zenity. Which of course isn't a built in part of the Bash shell. But it does allow you to create simple GUI