Re: [Tutor] Socket and Changing IP's

2011-02-28 Thread Sander Sweers
On Tue,  1 Mar 2011, 01:02:23 CET, Jacob Bender wrote: >          I'm trying to be a host without having to keep the computer on ALL > of the time. Acting as a "Dropbox" would be an example. My IP doesn't > change very often. It's stayed the same for days. The best solution here is to get a

[Tutor] A class that instantiates conditionally ?

2011-02-28 Thread David
I have an idea that might clean up my code slightly, if I can make one of my classes clever enough to refuse to instantiate itself if a necessary condition is not met. Below I propose some example code that seems to achieve this, and I am asking here for feedback on it, because I have not written

Re: [Tutor] Timer with exe command

2011-02-28 Thread Alan Gauld
"Kaden McLaws" wrote I would like to set up the following using python: A timer that is activated when a user logs on to our computer, then shuts the computer down when the timer runs out You can do that from the Operating System, no programming required. But hopw you do it wioll depend on wh

Re: [Tutor] Socket and Changing IP's

2011-02-28 Thread David Hutto
On Mon, Feb 28, 2011 at 7:02 PM, Jacob Bender wrote: > On 2/28/2011 6:57 PM, Wayne Werner wrote: > > On Mon, Feb 28, 2011 at 5:49 PM, Jacob Bender > wrote: >> >> Tutors, >> >>    I was looking into network programming, and I came across a problem. >> Socket programs need an IP address to function

Re: [Tutor] Socket and Changing IP's

2011-02-28 Thread Jacob Bender
On 2/28/2011 6:57 PM, Wayne Werner wrote: On Mon, Feb 28, 2011 at 5:49 PM, Jacob Bender > wrote: Tutors, I was looking into network programming, and I came across a problem. Socket programs need an IP address to function correctly, right? Well,

Re: [Tutor] Socket and Changing IP's

2011-02-28 Thread Wayne Werner
On Mon, Feb 28, 2011 at 5:49 PM, Jacob Bender wrote: > Tutors, > >I was looking into network programming, and I came across a problem. > Socket programs need an IP address to function correctly, right? Well, IP > addresses are always changing, so how should I go about making sockets that > wil

[Tutor] Socket and Changing IP's

2011-02-28 Thread Jacob Bender
Tutors, I was looking into network programming, and I came across a problem. Socket programs need an IP address to function correctly, right? Well, IP addresses are always changing, so how should I go about making sockets that will work for an extended period of time? Thanks in advance!

Re: [Tutor] string conversion

2011-02-28 Thread Steven D'Aprano
Robert Clement wrote: Hi I have a wxpython control in which users are intended to enter control characters used to define binary string delimiters, eg. '\xBA\xBA' or '\t\r\n' . Do you mean that your users enter *actual* control characters? What do they type to enter (say) an ASCII null ch

[Tutor] string conversion

2011-02-28 Thread Robert Clement
Hi I have a wxpython control in which users are intended to enter control characters used to define binary string delimiters, eg. '\xBA\xBA' or '\t\r\n' . The string returned by the control is a unicode version of the string entered by the user, eg. u'\\xBA\\xBA' or u'\\t\\r\\n' . I wo

Re: [Tutor] Timer with exe command

2011-02-28 Thread Corey Richardson
On 02/28/2011 03:30 PM, Corey Richardson wrote: > On 02/27/2011 10:02 PM, Kaden McLaws wrote: >> I would like to set up the following using python: A timer that is activated >> when a user logs on to our computer, then shuts the computer down when the >> timer runs out (no matter what, ending all

Re: [Tutor] numpy import failure

2011-02-28 Thread Alan Gauld
"Ezra Kahn" wrote appreciate the help, I am so new at this, I don't know if things aren't working because it is me, or because something else is wrong (I feel like a person who has known how to drive for years, but never bothered to look under the hood of the car). Thats a good analogy and

Re: [Tutor] Timer with exe command

2011-02-28 Thread Corey Richardson
On 02/27/2011 10:02 PM, Kaden McLaws wrote: > I would like to set up the following using python: A timer that is activated > when a user logs on to our computer, then shuts the computer down when the > timer runs out (no matter what, ending all programs). First, a raw input is > used, so that if

Re: [Tutor] Converting .pyd to .so

2011-02-28 Thread Alan Gauld
"j ram" wrote The DLL wraps a device driver, and the library of the SWIG wrapped device driver calls is invoked from a Python app. I was trying to find how this device driver (DLL) could be used on Linux without having to re-write the whole driver code for Linux. In general you can't use a

Re: [Tutor] Multiples python files

2011-02-28 Thread Alan Gauld
"Christopher Brookes" wrote I don't understand @classmethod def DisplayAll(cls, herosAll): What is cls ? This is one of the advanced techniques I referred to a few days ago. Basically the "best"(?) solution to your problem is to store the list of characters inside the Character clas

Re: [Tutor] Converting .pyd to .so

2011-02-28 Thread Stefan Behnel
j ram, 28.02.2011 18:49: Wine is a good suggestion, but it takes up 3.53 MB. Is there a lighter alternative? So far, you didn't state whether the DLL actually uses Windows calls, but I would imagine it does, and if so, you can't use it on anything but Windows without emulating those calls, thus

Re: [Tutor] numpy import failure

2011-02-28 Thread Andre' Walker-Loud
>> Andre > Thanks again for your responses. I am using MS Windows 7, and it turns out > there was a problem with build and re-installing EPD fixed it. I appreciate > the help, I am so new at this, I don't know if things aren't working because > it is me, or because something else is wrong (I f

Re: [Tutor] Converting .pyd to .so

2011-02-28 Thread j ram
> Wine is a good suggestion, but it takes up 3.53 MB. Is there a lighter >> alternative? >> > > So far, you didn't state whether the DLL actually uses Windows calls, but I > would imagine it does, and if so, you can't use it on anything but Windows > without emulating those calls, thus using Wine.

Re: [Tutor] numpy import failure

2011-02-28 Thread Ezra Kahn
On 2/27/2011 9:36 PM, tutor-requ...@python.org wrote: Date: Sun, 27 Feb 2011 18:58:46 -0800 From: Andre' Walker-Loud To: Ezra Kahn Cc:tutor@python.org Subject: Re: [Tutor] numpy import failure Message-ID:<75198436-f849-4994-8d48-1726c2ee7...@gmail.com> Content-Type: text/plain; charset=us-ascii

Re: [Tutor] Bitwise operation

2011-02-28 Thread Steven D'Aprano
tee chwee liong wrote: my IDLE seems to be giving me some funny error. i'm using Python 2.5 and Win XP. pls advise. a=0b110010 SyntaxError: invalid syntax Base two literals were only added to Python in version 2.6. [steve@sylar ~]$ python2.6 ... >>> 0b111 7 In 2.5 and older, this is a

Re: [Tutor] Timer with exe command

2011-02-28 Thread Wayne Werner
On Sun, Feb 27, 2011 at 9:02 PM, Kaden McLaws wrote: > > > I would like to set up the following using python: A timer that is > activated when a user logs on to our computer, then shuts the computer down > when the timer runs out (no matter what, ending all programs). First, a raw > input is used,

Re: [Tutor] Multiples python files

2011-02-28 Thread Izz ad-Din Ruhulessin
You can only call methods on a class without instantiating it, if it are classmethods. http://pyref.infogami.com/classmethod 2011/2/28 Christopher Brookes > I don't understand > > @classmethod > def DisplayAll(cls, herosAll > ): > > What is cls ? > > 2011/2/28 Izz ad-Din Ruhulessin > >> @c

Re: [Tutor] Multiples python files

2011-02-28 Thread Christopher Brookes
I don't understand @classmethod def DisplayAll(cls, herosAll): What is cls ? 2011/2/28 Izz ad-Din Ruhulessin > @classmethod > def DisplayAll(herosAll): > > is of course: > > @classmethod > def DisplayAll(cls, herosAll): > > 2011/2/28 Izz ad-Din Ruhulessin > > Hi, you must pass the

Re: [Tutor] Multiples python files

2011-02-28 Thread Izz ad-Din Ruhulessin
@classmethod def DisplayAll(herosAll): is of course: @classmethod def DisplayAll(cls, herosAll): 2011/2/28 Izz ad-Din Ruhulessin > Hi, you must pass the herosAll list to the DisplayAll() method like this > > class Character(): > @classmethod > def DisplayAll(herosAll): >

Re: [Tutor] Multiples python files

2011-02-28 Thread Izz ad-Din Ruhulessin
Hi, you must pass the herosAll list to the DisplayAll() method like this class Character(): @classmethod def DisplayAll(herosAll): print ('There is', Character.CharacterCount, 'heros') for heros in herosAll: heros.DisplayCharacterInfos() herosAll = [ Character

Re: [Tutor] Bitwise operation

2011-02-28 Thread tee chwee liong
> Binary (leading with '0b'): > >>> 0b1110 & 0b0110 > 6 > > Good luck, > > -Martin > my IDLE seems to be giving me some funny error. i'm using Python 2.5 and Win XP. pls advise. >>> a=0b110010 SyntaxError: invalid syntax >>> 0b1110 & 0b0110 SyntaxError: invalid syntax >>> 0b10 SyntaxErr

[Tutor] Multiples python files

2011-02-28 Thread Christopher Brookes
Hi, first sorry for my poor english, i'm a french guy, i'm trying to make the best :( I would like to split my python script into multiples files. I want : A file which contains only class creations and methods, A file with some personals functions And a main.py which is the main script. But i'm

Re: [Tutor] Bitwise operation

2011-02-28 Thread David Hutto
On Mon, Feb 28, 2011 at 4:43 AM, Martin A. Brown wrote: > >  : i'm confused with & and AND. for eg: >  : >>> 1110 & 0110 >  : 64 >  : >>> 1110 and 0110 >  : 72 >  : >  : i'm expecting if 1110 and with 0110 will get 0110 or 6. >  : pls advise. > > Above, python thinks you are representing one numbe

Re: [Tutor] Bitwise operation

2011-02-28 Thread Martin A. Brown
: i'm confused with & and AND. for eg: : >>> 1110 & 0110 : 64 : >>> 1110 and 0110 : 72 : : i'm expecting if 1110 and with 0110 will get 0110 or 6. : pls advise. Above, python thinks you are representing one number in decimal notation and the other in octal. Decimal (no leading zeroe

[Tutor] Bitwise operation

2011-02-28 Thread tee chwee liong
hi, i'm confused with & and AND. for eg: >>> 1110 & 0110 64 >>> 1110 and 0110 72 i'm expecting if 1110 and with 0110 will get 0110 or 6. pls advise. thanks tcl ___ Tutor maillist - Tutor@python.org To

[Tutor] Timer with exe command

2011-02-28 Thread Kaden McLaws
I would like to set up the following using python: A timer that is activated when a user logs on to our computer, then shuts the computer down when the timer runs out (no matter what, ending all programs). First, a raw input is used, so that if you know the password, you may shut off the time