Re: When writing text. . .

2006-07-24 Thread Ivan Shevanski
On 7/14/06, Gerhard Fiedler <[EMAIL PROTECTED]> wrote:
On 2006-07-14 18:05:56, Ivan Shevanski wrote:> Hey I'm pretty new to python and I have a question.  I'm trying to write:> "[BOOT]> run=C:\windows\aawin.bat">> in my win.ini
> So I went about it like this:>> win = open('C:\windows\win.ini', 'a')> win.write('[BOOT]')> win.write('\n')> win.write('run=C:\windows\aawin.bat')Maybe write a '\n' before the [BOOT] -- unless you can guarantee that the
previous line ends with a CRLF.BTW, it's probably a good thing to always escape the backslash (that is,use '\\') when you want a backslash, not only for the '\\a' case. Or ofcourse use a raw string.
Gerhard--http://mail.python.org/mailman/listinfo/python-listSorry about the late response, I was away.  Thanks for all the help =D
-- -Ivan
-- 
http://mail.python.org/mailman/listinfo/python-list

When writing text. . .

2006-07-14 Thread Ivan Shevanski
Hey I'm pretty new to python and I have a question.  I'm trying to write:"[BOOT]run=C:\windows\aawin.bat"in my win.iniSo I went about it like this:win = open('C:\windows\win.ini', 'a')
win.write('[BOOT]')win.write('\n')win.write('run=C:\windows\aawin.bat')I expected that to work, but instead of C:\windows\aawin.bat I get run=C:\windowsawin.bat. . .I assume /a is a code for  like /n is for a newline, is there a way to fix this?
Thanks in advance,-Ivan
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Wake on LAN and Shutdown for Windows and Linux

2006-05-03 Thread Ivan Shevanski

On 5/3/06, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
On 2 May 2006 12:02:50 -0700, [EMAIL PROTECTED] declaimed the
following in comp.lang.python:>> Also, How can I shutdown other Linux terminals from my Main (Linux) ?>   Uhm... Telnet into the other workstations using the root account (orsome other account with the needed privileges) and execute the machine
specific shutdown command (and disconnect the Telnet session before itshuts down so you don't accidentally trigger another "wake"?)?   Windows is the hard one...--   WulfraedDennis Lee Bieber   KD6MOG
   [EMAIL PROTECTED]   [EMAIL PROTECTED]   HTTP://wlfraed.home.netcom.com/
   (Bestiaria Support Staff:   [EMAIL PROTECTED])   HTTP://www.bestiaria.com/--
http://mail.python.org/mailman/listinfo/python-list
 
You could probably write an easy batch file for windows. . .For Linux?  Maybe use the recipe.  Sorry its not in Python =D-- -Ivan 
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-23 Thread Ivan Shevanski
On 2/23/06, Claudio Grondi <[EMAIL PROTECTED]> wrote:
Paul Probert wrote:> Hi,>   My app runs in a loop looking for changes in a database, and like a> good boy I call time.sleep(1) inside the loop. Unfortunately this> sometimes runs for 200 seconds or so, presumably while my OS is calling
> Bill Gates to tell him what I've been doing. This happens under NT4,> W2k, and XP. What do people do to fix this? Thanks!>> Paul Probert> University of Wisconsin>In similar situation I would start to blame the hardware for the
problem, so below a kind of checklist to go through:   1. have you changed any hardware?   2. have you installed new drivers?   3. have you connected via USB/Firewire/IDE or other interfaces/portsetc. some new devices?
   4. have you installed new BIOS?   5. is your RAM ok?   6. are you sure there is no CD/DVD in your CD/DVD drive?   7. are you sure there is no floppy disk in your floppy drive?   8. are you sure your CPU/motherboard/RAM is not overheating?
Claudio--http://mail.python.org/mailman/listinfo/python-listSo what exactly does the loop do? Try running the loop without sleep and then see how long that takes.
-- -Ivan
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Learning Python

2006-02-05 Thread Ivan Shevanski

On 2/5/06, Ivan Shevanski <[EMAIL PROTECTED]> wrote:


On 2/5/06, Ivan Shevanski <[EMAIL PROTECTED]
> wrote: 


On 2/5/06, Florian Nykrin <[EMAIL PROTECTED] 
> wrote: 
Hi Byte!Your code should look like this:x = raw_input('Please enter your name: ')if x == 'myself': print 'OK' 
Because myself should be a string and not a variable name, you have toput it in quotes.Regards, Florian.--
http://mail.python.org/mailman/listinfo/python-list 
--  Oh, I was under the impression that myself is a variable name. . .Who would type in myself as their name? 
If it is a variable it's fine how it is, but if it is a string put it in quotes.-Ivan Ugh sorry read it wrong, thats right.-- 
-Ivan 
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Learning Python

2006-02-05 Thread Ivan Shevanski

On 2/5/06, Ivan Shevanski <[EMAIL PROTECTED]> wrote:


On 2/5/06, Florian Nykrin <[EMAIL PROTECTED]
> wrote: 
Hi Byte!Your code should look like this:x = raw_input('Please enter your name: ')if x == 'myself': print 'OK' 
Because myself should be a string and not a variable name, you have toput it in quotes.Regards, Florian.--
http://mail.python.org/mailman/listinfo/python-list 
--  Oh, I was under the impression that myself is a variable name. . .Who would type in myself as their name? 
If it is a variable it's fine how it is, but if it is a string put it in quotes.-Ivan 
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Loop exception catching

2006-01-25 Thread Ivan Shevanski
On 1/25/06, Ivan Shevanski <[EMAIL PROTECTED]> wrote:
On 1/25/06, Fredrik Lundh <
[EMAIL PROTECTED]> wrote:
Aldo Cortesi wrote:> > What do you mean?>> Well, the problem with "input" is that it allows the user to supply an> arbitrary Python _expression_, which will then be executed. Among other things,
> this means that your pet cat could make your script exit due to an uncaught> exception by simply walking accross your keyboard. If your cat is sufficiently> clever, it could also empty your bank account, email your entire porn
> collection to your mother, and then erase your hard drive.but that the cat would be clever enough to make your script exit and then doevil stuff from the shell is completely out of the question.

--http://mail.python.org/mailman/listinfo/python-list
Hah, I'll never look at cats the same way again. . .Thanks for your help everyone!-- -Ivan
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Loop exception catching

2006-01-24 Thread Ivan Shevanski
On 1/23/06, Aldo Cortesi <[EMAIL PROTECTED]> wrote:
Well, leaving aside the merits of using "input" (which should be avoided at allcosts), here's one way to do what you want:while 1:try:x = input("> ")break
except SyntaxError:print "explain the problem here"Cheers,AldoThanks, that seems to work fine.  But about your other comment. . .
>Well, leaving aside the merits of using "input" (which should be avoided at all>costs)What do you mean?-- -Ivan
-- 
http://mail.python.org/mailman/listinfo/python-list

Loop exception catching

2006-01-23 Thread Ivan Shevanski
Alright this is kind of a continuation of a past conversation. . .But not really.  Anyway, heres the problem.  Say I had this:
    try:    x = input("> ")    except SyntaxError:   print "explain the problem here"   x = input("> ")That's
to catch when people just press enter by mistake without selecting
something from the menu.  But the thing is how would I make that loop?
I want it to keep catching the user pressing enter if they did it over
and over [there are some weird people out there ;)] I tryed this but to
no avail:
    try:    x = input("> ")    except SyntaxError:    while SyntaxError:    print "Please enter only the number beside your choice"    print
    x = input("> "). . .Any suggestions?Thanks in advance,-Ivan
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Variables and none?

2006-01-20 Thread Ivan Shevanski
On 1/20/06, Ivan Shevanski <[EMAIL PROTECTED]> wrote:
Alright first of all I'd like to say I'm a python noob.Now that thats over with, heres what I'd like to know about.  Is there a python way to detect if a variable exsists?  Say I had a program that needed a certain variable to be set to run and the variable was not found when it came time to use it. . .Would I just have to catch the error, or could I have python look for the variable beforehand?
Thanks,-Ivan

Oh, sorry to waste your time I got it =D-- -Ivan
-- 
http://mail.python.org/mailman/listinfo/python-list

Variables and none?

2006-01-20 Thread Ivan Shevanski
Alright first of all I'd like to say I'm a python noob.Now that thats over with, heres what I'd like to know about.  Is there a python way to detect if a variable exsists?  Say I had a program that needed a certain variable to be set to run and the variable was not found when it came time to use it. . .Would I just have to catch the error, or could I have python look for the variable beforehand?
Thanks,-Ivan
-- 
http://mail.python.org/mailman/listinfo/python-list

Favorite flavor of Linux? (for python or anything else)

2005-12-04 Thread Ivan Shevanski
Looking to replace my older flavor of linux with something new. . .What
are some of your favorites for python programming and anything
else?  

Thanks,
 -Ivan
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Clearing output screen

2005-11-06 Thread Ivan Shevanski
On 11/6/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
Ivan Shevanski wrote> I know there is a way to do this, but google doesn't seem to want to find it> =) There is a command to clear the output screen right?no, because "output screen" isn't a well-defined concept on modern
operating systems.  the following works in many cases:import osif os.name == "nt":os.system("cls")else:os.system("clear")
--http://mail.python.org/mailman/listinfo/python-listThat seems to work just fine.  Thanks Fredrik!
-Ivan
-- 
http://mail.python.org/mailman/listinfo/python-list

Clearing output screen

2005-11-06 Thread Ivan Shevanski
I know there is a way to do this, but google doesn't seem to want to
find it =)  There is a command to clear the output screen right? 

Thanks in advance,
 -Ivan
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Multiples of a number

2005-11-06 Thread Ivan Shevanski
On 11/5/05, Steven D'Aprano <[EMAIL PROTECTED]> wrote:
On Sun, 06 Nov 2005 02:39:40 +0100, Carl Friedrich Bolz wrote:> Hi!>> Ivan Shevanski wrote:>> I've searched on google for a bit but I can't seem to find a way to get>> multiples of a number. . .For instance what would I do if I wanted
>> something to happen every time x reached a multiple of 100 in this>> sample code:>>>> x = 0>> while x < 2000:>>  x += 1>>>> The idea is to use to modulo operator % which gives you the residue of a
> number when divided by another number:> for x in range(2000):>  if x % 100 == 0:>  do_something()Another way is, if you aren't doing anything *except* counting for the
other 99 values of x, just skip them completely:fox x in range(20):do_something(x*100)Ivan, what are you trying to do?--Steven.--
http://mail.python.org/mailman/listinfo/python-listSorry
for the late response.  What I'm doing is pretty simple, I just
have a counter running and every time the counter gets to a multiple of
100 it runs a function.  So Carl's solution will work fine. Thanks
everyone!


Thanks,
-Ivan
-- 
http://mail.python.org/mailman/listinfo/python-list

Multiples of a number

2005-11-05 Thread Ivan Shevanski
I've searched on google for a bit but I can't seem to find a way to get
multiples of a number. . .For instance what would I do if I wanted
something to happen every time x reached a multiple of 100 in this
sample code:

x = 0
while x < 2000:
 x += 1

Thanks in advance,
-Ivan
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: putting an Icon in "My Computer"

2005-11-03 Thread Ivan Shevanski

On 11/3/05, Ivan Shevanski <[EMAIL PROTECTED]> wrote:


On 3 Nov 2005 18:28:49 -0800, Brett Hoerner <
[EMAIL PROTECTED]> wrote: 
> I've been asked by my boss to put an Icon in WinXP's "My Computer" for> a utility we use around the shop.  My tool of choice is of course 
> Python and therefore what I am using to attempt my given task.  I have> no trouble putting Icons in the WinXP Toolbar using Python, but have> totally failed to get an Icon to appear in My Computer.  Any Idea on 
> why and maybe how to get around this using Python?I'm pretty sure the My Computer menu is limited to devices and specialWindows folders like My Documents, etc.  I've never seen a program addan icon there, and I don't think its allowed through the API. 
--http://mail.python.org/mailman/listinfo/python-list

If this can be achieved at all, it would be through the windows registry.  I know you can change all the icons for the recycle bin and special folders through it. . .I would figure adding folders might even be under the same key.  Try google. 

 
 
-Ivan 
Actually, this link might just be what you need.
http://www.winguides.com/registry/display.php/73/
 
 
Hope that helps,-Ivan 
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: putting an Icon in "My Computer"

2005-11-03 Thread Ivan Shevanski

On 3 Nov 2005 18:28:49 -0800, Brett Hoerner <[EMAIL PROTECTED]> wrote:
> I've been asked by my boss to put an Icon in WinXP's "My Computer" for> a utility we use around the shop.  My tool of choice is of course
> Python and therefore what I am using to attempt my given task.  I have> no trouble putting Icons in the WinXP Toolbar using Python, but have> totally failed to get an Icon to appear in My Computer.  Any Idea on
> why and maybe how to get around this using Python?I'm pretty sure the My Computer menu is limited to devices and specialWindows folders like My Documents, etc.  I've never seen a program addan icon there, and I don't think its allowed through the API.
--http://mail.python.org/mailman/listinfo/python-list
If this can be achieved at all, it would be through the windows registry.  I know you can change all the icons for the recycle bin and special folders through it. . .I would figure adding folders might even be under the same key.  Try google.

 
 
-Ivan 
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: WTF?

2005-11-01 Thread Ivan Shevanski
On 11/1/05, James Stroud <[EMAIL PROTECTED]> wrote:
Why do my posts get held for suspcious headers and troll Xha Lee gets to postall sorts of profanity and ranting without any problem?--James StroudUCLA-DOE Institute for Genomics and ProteomicsBox 951570
Los Angeles, CA 90095http://www.jamesstroud.com/--http://mail.python.org/mailman/listinfo/python-list
Hey man I feel your pain. Happens to me all the time.

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Yes, this is a python question, and a serious one at that (moving to Win XP)

2005-10-15 Thread Ivan Shevanski
On 10/14/05, Peter Hansen <[EMAIL PROTECTED]> wrote:
Christian Stapfer wrote:> 0.0. ... and add an item to your SendTo folder that allows> you to have Windows Explorer open a terminal window with its> current directory set to the currently displayed folder
> (= "Open terminal here").Or install the "Command Prompt Here" gadget that MS produces, which hasa massive installer and a click-through license thing and everything,just to open a freakin' prompt at a given directory
-PeterThere's
an excellent windows registry edit to open a command prompt at the
given directory that I've been using. . .Here's a link. 
http://www.winguides.com/registry/display.php/260/Hope that helps,-Ivan
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Newbie needs help. Setting PYTHONDOCS to read HTML.

2005-10-10 Thread Ivan Shevanski
You can still use it, but you can't use the help. I don't know but this has always been better than the help for me! =D-- -Ivan
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: noob question Letters in words?

2005-10-08 Thread Ivan Shevanski

Thanks everyone for helping once again, lots of good ideas there

Thanks,

-Ivan

_
FREE pop-up blocking with the new MSN Toolbar – get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


-- 
http://mail.python.org/mailman/listinfo/python-list

Re: noob question Letters in words?

2005-10-07 Thread Ivan Shevanski
>Is it *really* a good idea if the user types "STOP!!!" and it has the
>same effect as if they typed "Start please"?
>
>I've heard of "Do what I mean, not what I said" systems, which are usually
>a really bad idea, but this is the first time I've seen a "Do what I don't
>mean, not what I said" system.

=D

Alright, I'm going to stop trying to defend my idea since it's obviously a 
bad one.  What do you recommend?

-Ivan

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: noob question Letters in words?

2005-10-07 Thread Ivan Shevanski
Yes, I realize that. . .Heres another question then. I was trying somehting 
before so that if the user just pressed enter by accident, it would not 
accept the input and ask them to put in another. But the thing is I couldnt 
get it to work. I tryed if choice1 == None it would loop and ask for a new 
input but that didnt seem to work. . .Any ideas for that?



Thanks,
Ivan

_
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


-- 
http://mail.python.org/mailman/listinfo/python-list

Re: noob question Letters in words?

2005-10-07 Thread Ivan Shevanski

>Perhaps a better idea is to present the user with a choice that cannot
>be deviated from, along the lines of...
>
>def main():
>   print "1.\tStart"
>   print "2.\tSomething Else"
>   print "3.\tStop"
>
>   x = raw_input()
>   if x is '1': print 'Start'
>   elif x is '2': print 'Something else'
>   elif x is '3': print 'End'
>   else: main()

Right but see what if the user wants to type Start? I've already used the 
number menu but too many people get confused by it. . .Any other ideas?

Thanks,

-Ivan

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

-- 
http://mail.python.org/mailman/listinfo/python-list


noob question Letters in words?

2005-10-07 Thread Ivan Shevanski
Alright heres another noob question for everyone.  Alright, say I have a 
menu like this.

print "1. . .Start"
print "2. . .End"
choice1 = raw_input("> ")

and then I had this to determine what option.


if choice1 in ('1', 'Start', 'start'):
#do first option
if choice1 in ('2', 'End', 'end'):
#do second option

Is there a way (I searched for a module but didnt find one) that I can do 
something like this?

if choice1 in ('1', 'S', 's'):
#do first option
if choice1 in ('2', 'E', 'e'):
#do second option


For instance I could type in Stop and would get the first option since it 
had an "s" in it?
Anyone heard of any way to do this?

Thanks,
-Ivan



By the way, if anyone gets tired of my persistant noob questions please tell 
me I don't want to bother anyone =D

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Class Help

2005-10-02 Thread Ivan Shevanski
Thanks everyone for helping me out and tolerating the noob question =D  The 
last part was confusing to me and thanks for explaining it so I get it!


-Ivan

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

-- 
http://mail.python.org/mailman/listinfo/python-list


Class Help

2005-10-01 Thread Ivan Shevanski
To continue with my previous problems, now I'm trying out classes.  But I 
have a problem (which I bet is easily solveable) that I really don't get.  
The numerous tutorials I've looked at just confsed me.For intance:

>>>class Xyz:
... def y(self):
... q = 2
...
>>>Xyz.y()
Traceback (most recent call last):
  File "", line 1, in ?
TypeError: unbound method y() must be called with Xyz instance as first 
argument
(got nothing instead)


So. . .What do I have to do? I know this is an extremley noob question but I 
think maybe if a person explained it to me I would finally get it =/


thanks in advance,

-Ivan

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help with syntax warnings

2005-10-01 Thread Ivan Shevanski
Well I've been experimenting with the warning filter and it doesn't seem to 
be working. . .I think it has something to do with the fact that warnings 
are issued during the compiling and not during the excecution. . .So the 
filter would come in to late to block them? Any ideas?

-Ivan

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

-- 
http://mail.python.org/mailman/listinfo/python-list


Turning off syntax warnings?

2005-09-30 Thread Ivan Shevanski
Here's a noob question for everyone which i can't seem to find the answer to 
on google. . .Is there a way to turn off syntax warnings?




-Ivan

_
FREE pop-up blocking with the new MSN Toolbar – get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


-- 
http://mail.python.org/mailman/listinfo/python-list

Help with syntax warnings

2005-09-29 Thread Ivan Shevanski
Here's a noob question for everyone (I'm not sure if my first message got 
through, is had a "suspicious header" so sorry for double post is so), is 
there a way to turn off syntax warnings or just make them not visible?


Thanks,
-Ivan

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Carrying variables over from function to function

2005-09-26 Thread Ivan Shevanski
Thanks for your quick responce Roy, thats exactly what I needed. =)


-Ivan

_
On the road to retirement? Check out MSN Life Events for advice on how to 
get there! http://lifeevents.msn.com/category.aspx?cid=Retirement

-- 
http://mail.python.org/mailman/listinfo/python-list


Carrying variables over from function to function

2005-09-25 Thread Ivan Shevanski
Alright heres my problem. . .Say I want to carry over a variable from one 
function to another or even another run of the same function. Is that 
possible? Heres a quick example of what I'm talking about.


def abc():
   x = 1
   y = x + 1
   print y

def abcd():
   y = x + 1
   print y

abc()
abcd()

the output would be:


abc()

2

abcd()

Traceback (most recent call last):
   File "(stdin)", line 1, in ?
   File "(stdin)", line 2, in abcd
NameError: global name 'x' is not defined







See, I want y in the second function to equal 4, carrying the x from the 
first function over to the next.  Is there any way to do this?




-Ivan

_
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


-- 
http://mail.python.org/mailman/listinfo/python-list

RE: Survey Tool

2005-08-31 Thread Ivan Shevanski

Wait. . .Do you want it on a website? I don't really understand you


-Ivan

_
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


-- 
http://mail.python.org/mailman/listinfo/python-list

Re: py to exe: suggestions?

2005-08-30 Thread Ivan Shevanski
Not sure if you already got the answer to this lol but since this is one 
thing about python i do know how to do, use CXFreeze.  Its basicly a 
combination of all the programs you have already tryed. Works great for me 
=D sorry I dont have a link, just google it.

-Ivan

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

-- 
http://mail.python.org/mailman/listinfo/python-list


hotmail filter question with list

2005-08-11 Thread Ivan Shevanski
Just a quick mailing question for anyone who uses hotmail and gets this.  Im 
having problems with my filters =/ i have a filter for mails with 
python-list@python.org in to or cc, but i still get some in my inbox. 
anyone?



-Ivan

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to run commands in command line from a script

2005-07-01 Thread Ivan Shevanski
Well, the thing is that I was just using changing directories as an example 
for running a name specific command, is the  the 
only way to run name specific commands? An example would be (what I am 
actually trying to do) run the simply command

mame s1945
in the command line.  MAME is, for those of you that care, the multaple 
arcade machine emulator and the command runs the classic game strikers 1945. 
 I'm just trying to automate the tedious process of running it through the 
command line.  By the way, thanks to everyone who responded I'm really 
getting along here.


Thanks,
-Ivan





>
> Generally, the only way to use an application (i.e. a program like the
> Python interpreter, or your own .exe) to change the working folder is to
> have your script executed from within a batch file, write out a new
> batch file in your script, and then have the calling batch file execute
> that script if it exists.

And, after that long-winded reply, here's another option, if you're just
trying to change the directory _within_ your app but don't care if the
change persists:

import os
os.chdir(r'c:\Program Files')

-Peter
--


_
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


-- 
http://mail.python.org/mailman/listinfo/python-list

Re: How to run commands in command line from a script

2005-06-30 Thread Ivan Shevanski
Alright well I'm quite a noob and when I run a simple command to change the 
current directory, nothing happens.  I made a little test script to show it:



import os
cwd = os.getcwd()
print cwd
os.system('cd = C:\Program Files')
print cwd


then the result:

C:\Python24\Python Scripts
C:\Python24\Python Scripts

The cd never changed. . .  Can somebody explain this? I think I need to add 
something simple, i didnt quite  get the example 'os.system('./some 
--command')'



-Ivan





From: Robert Kern <[EMAIL PROTECTED]>
To: python-list@python.org
Subject: Re: How to run commands in command line from a script
Date: Thu, 30 Jun 2005 20:01:29 -0700

Ivan Shevanski wrote:
> I know there is an easy way to do this, and I just can not remember. I 
have
> already searched where I thought the module would be. . . I just want to 
run

> some name specific commands.  Is this easily possible?

Quick and dirty:

   import os
   os.system('./some --command')

More robust: Use the subprocess module.

--
Robert Kern
[EMAIL PROTECTED]

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter


--

_
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


-- 
http://mail.python.org/mailman/listinfo/python-list

How to run commands in command line from a script

2005-06-30 Thread Ivan Shevanski
I know there is an easy way to do this, and I just can not remember. I have 
already searched where I thought the module would be. . . I just want to run 
some name specific commands.  Is this easily possible?


Thanks,
-Ivan

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

-- 
http://mail.python.org/mailman/listinfo/python-list


Open the command line within a script

2005-06-30 Thread Ivan Shevanski
Hey this is probally a noob question but here goes. . .How could I open the 
command line inside of a python script?  Would I have to use COM?




-Ivan

_
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


-- 
http://mail.python.org/mailman/listinfo/python-list

Re: help with sending mail in Program

2005-06-15 Thread Ivan Shevanski

Well everything was working in this mail sending script until. . .this:

Traceback (most recent call last):
 File "mailvar.py", line 27, in ?
   sendToMe(subject, body)
 File "mailvar.py", line 8, in sendToMe
   send(me, me, subject, body)
 File "mailvar.py", line 16, in send
   msg = MIMEText(body)
 File "C:\Python24\lib\email\MIMEText.py", line 28, in __init__
   self.set_payload(_text, _charset)
 File "C:\Python24\lib\email\Message.py", line 218, in set_payload
   self.set_charset(charset)
 File "C:\Python24\lib\email\Message.py", line 256, in set_charset
   cte(self)
 File "C:\Python24\lib\email\Encoders.py", line 63, in encode_7or8bit
   orig.encode('ascii')
AttributeError: 'tuple' object has no attribute 'encode'

heres my code(just made to test using the variables):

from email.MIMEText import MIMEText
from smtplib import SMTP
x = 'python'
y = 'python2'

def sendToMe(subject, body):
  me = '"Ivan Shevanski" <[EMAIL PROTECTED]>'
  send(me, me, subject, body)

def send(frm, to, subject, body):
  s = SMTP()
  s.set_debuglevel(1)
  s.connect('D421LN41')
#   s.ehlo('69.137.27.32')

  msg = MIMEText(body)
  msg['To'] = to
  msg['Subject'] = subject
  msg['From'] = frm

  s.sendmail(frm2, [to2], msg.as_string())
  s.quit()

if __name__ == '__main__':
  body = 'x is',x,'y is',y,'.Lets hope that works!'
  subject = 'Python3'
  sendToMe(subject, body)

I really have no idea whats going on. . .help?

-Ivan

_
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


-- 
http://mail.python.org/mailman/listinfo/python-list

RE: A question about time

2005-06-09 Thread Ivan Shevanski





From: Jan Danielsson <[EMAIL PROTECTED]>
To: python-list@python.org
Subject: A question about time
Date: Thu, 09 Jun 2005 22:58:17 +0200

Hello all,

   I have a list of servers which an application connects to. If the
connection fails, the application should mark the server as temporarily
unavailable, and should try to use the server again after x units of time.

In C, I would do this:

server.invalidUntil = time(NULL) + 5*60; // five minute delay

..and the check:

if(time(NULL) > server.invalidUtil)
{
   // use server
}

So the whole thing very simple... But how do I do that in Python?

   I have found datetime.datetime.now(), but I don't understand what
"format" it returns the time in. I assume it's an object of some sort..
But how do I do if I want the current time as an integer (unix
timestamp) in Python?

---
Heres the time module link, use a combination of the modules to get the 
complete time. Use time.sleep() to sleep for a certain amount of SECONDS.  
Not minutes.  So:



from sleep import time
sleep(5)


would have the program or script stop and wait for 5 seconds.  I hope this 
was what your were asking for, I didn't quite get the question.


-Ivan

_
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


-- 
http://mail.python.org/mailman/listinfo/python-list

RE: smtpd module

2005-06-09 Thread Ivan Shevanski
So youre wondering how to send mail in python? I have a lot of examples if 
you want the smtp module. I don't have anything for anything other than the 
smtp module.

-Ivan

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

-- 
http://mail.python.org/mailman/listinfo/python-list


RE: cx_freeze error : LookupError: no codec search functions registered:can't find encoding

2005-06-09 Thread Ivan Shevanski




From: "Thomas W" <[EMAIL PROTECTED]>
To: python-list@python.org
Subject: cx_freeze error : LookupError: no codec search functions 
registered:can't find encoding

Date: 9 Jun 2005 10:11:19 -0700

I get this error when I try to run a freezed exe on my ubuntu 5.04
running Python 2.4 :

LookupError: no codec search functions registered: can't find encoding

I've tried to use --include-modules encodings,codecs when freezing
without luck.

Any hints?

Regards,
Thomas

--
Did you freeze the script/program yourself? If so, do the version of Freeze 
you used and the version of Python match?  Also, which freeze did you use, 
the one off the internet or the one included with Python.  I may be able to 
help you.


-Ivan

_
FREE pop-up blocking with the new MSN Toolbar – get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


-- 
http://mail.python.org/mailman/listinfo/python-list

RE: Exe file

2005-06-09 Thread Ivan Shevanski


>From: "Philip Seeger" <[EMAIL PROTECTED]>
>To: python-list@python.org
>Subject: Exe file
>Date: Thu, 9 Jun 2005 18:24:15 +0200
>
>Hi @ll
>
>I'm sorry for that newbie question but how can I compile a program (a .py
>file) to an executable file?
>
>--
>Philip Seeger
>
>
Yes there is and its very easy, simplely use the Freeze program.  You can 
google it and download it, just run it and it will complile an exe for you, 
with a dll. Run it like any other apllication.

-Ivan

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help with sending mail in Program

2005-06-09 Thread Ivan Shevanski




#!/usr/local/bin/python

''' Send mail to me '''

from smtplib import SMTP

def sendToMe(subject, body):
me = '"Ivan Shevanski" <[EMAIL PROTECTED]>'
send(me, me, subject, body)


def send(frm, to, subject, body):
s = SMTP()
#///On or off for test\\\   #s.set_debuglevel(1)
s.connect('mail.hotmail.com',)
s.ehlo('69.137.27.32') # IP address of my computer, I don't

remember why I needed this
msg = '''From: %s
Subject: %s
To: %s

%s
''' % (frm, subject, to, body)

s.sendmail(frm, to, msg)

s.sendmail(frm, [to], msg)

s.quit()


if __name__ == '__main__':
sendToMe('test', 'test')


It says it sends it but I get nothing in my inbox or anywhere! This is
really frustrating me.

_

[tim williams]>   No it definitely works,  but Hotmail will blackhole your
constructed email as it is obviously fake.  It has no headers,  dates,
msg-id etc.

[tim williams]>   View the source of a real email in your mail client,  
then

cut & paste the whole thing  into your message variable like this

   msg = '''  '''

[tim williams]>  you should remove the  " % (frm, subject, to, body) " at
the end of the msg string

[tim williams]> for correctness, you also need an  "  s.rset()  " in 
between

each  " s.sendmail "   (but the script does work in its current form)

[tim williams]>  HTH  :)


Im good with everything except viewing the source. . .Do you mean the html 
source? Because I use hotmail, and not outlook or thunderbird or something 
like that.  Sorry, i'm a noob.


-Ivan

_
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Start application & continue after app exits

2005-06-09 Thread Ivan Shevanski
>From: Paul McNett <[EMAIL PROTECTED]>
>To: python-list@python.org
>Subject: Re: Start application & continue after app exits
>Date: Thu, 09 Jun 2005 09:07:47 -0700
>
>Guy Lateur wrote:
> > I was wondering if it would be possible to launch an application, block
> > until the app exits, and do some cleanup afterwards.
>
> > Maybe an example will be clearer: I would like to make a temperary 
>(text)
> > file, open it with MS Word for the user to edit/layout/print, and then
> > delete the temp file after the user shuts down Word. Is this feasible?
>
>Something like:
>
>import os
>import tempfile
>
>testString = "Life is but a dream."
>fileName = tempfile.mktemp()
>print fileName
>open(fileName, "w").write(testString)
>os.system("gedit %s" % fileName)
>os.remove(fileName)
>
>---
>Note that I'm on Linux, and instead of launching Word I'm launching an
>editor named "gedit". You could likely change that call to winword.exe,
>but I haven't tested it on Windows.
>
>Also note that this method of creating tempfiles is technically unsafe,
>as it is theoretically possible that another process would create a file
>of the same name in the same directory and then try to use it, resulting
>in a race condition between the two processes. This is practically
>unlikely, however, and I'm a pragmatist.
>
>
>--
>Paul McNett
>http://paulmcnett.com

--
Perhaps try the sys.exitfunc or atexit modules:

exitfunc
This value is not actually defined by the module, but can be set by the user 
(or by a program) to specify a clean-up action at program exit. When set, it 
should be a parameterless function. This function will be called when the 
interpreter exits. Only one function may be installed in this way; to allow 
multiple functions which will be called at termination, use the atexit 
module. Note: The exit function is not called when the program is killed by 
a signal, when a Python fatal internal error is detected, or when os._exit() 
is called.
Deprecated since release 2.4. Use atexit instead.

heres the link   

Hope it helps,
-Ivan

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help with sending mail in Program

2005-06-09 Thread Ivan Shevanski



>>#!/usr/local/bin/python
>>
>>''' Send mail to me '''
>>
>
>>from smtplib import SMTP
>
>>def sendToMe(subject, body):
>>   me = '"Kent Johnson" <[EMAIL PROTECTED]>'
>>   send(me, me, subject, body)
>>
>>
>>def send(frm, to, subject, body):
>>   s = SMTP()
>>#s.set_debuglevel(1)
>>   s.connect('mail.mycompany.com')
>>   s.ehlo('10.0.3.160') # IP address of my computer, I don't remember 
why I needed this

>>
>>   msg = '''From: %s
>>Subject: %s
>>To: %s
>>
>>%s
>>''' % (frm, subject, to, body)
>>
>>   s.sendmail(frm, to, msg)
>
>
> s.sendmail(frm, [to], msg)
>
>
>>   s.quit()
>>
>>
>>if __name__ == '__main__':
>>   sendToMe('Testing', 'This is a test')

---

I think this seems like it would work, but I still can't seem to get it to 
work.  I  turned on the debugging and everything seemed alright.  I'll post 
how I modified it (I probally made a simple mistake).  Can someone help 
here?



#!/usr/local/bin/python

''' Send mail to me '''

from smtplib import SMTP

def sendToMe(subject, body):
   me = '"Ivan Shevanski" <[EMAIL PROTECTED]>'
   send(me, me, subject, body)


def send(frm, to, subject, body):
   s = SMTP()
#///On or off for test\\\   #s.set_debuglevel(1)
   s.connect('mail.hotmail.com',)
   s.ehlo('69.137.27.32') # IP address of my computer, I don't

remember why I needed this
   msg = '''From: %s
Subject: %s
To: %s

%s
''' % (frm, subject, to, body)

   s.sendmail(frm, to, msg)

   s.sendmail(frm, [to], msg)

   s.quit()


if __name__ == '__main__':
   sendToMe('test', 'test')



It says it sends it but I get nothing in my inbox or anywhere! This is 
really frustrating me.


_
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


-- 
http://mail.python.org/mailman/listinfo/python-list

RE: identifying 64-bit Windows from 2.3.5?

2005-06-08 Thread Ivan Shevanski



From: Steven Knight <[EMAIL PROTECTED]>
To: python-list@python.org
Subject: identifying 64-bit Windows from 2.3.5?
Date: Wed, 8 Jun 2005 23:51:15 -0400 (EDT)

If I have installed 2.3.5 from the python.org Windows installer, can
any one point me to a run-time way to identify whether I'm running on
a 32-bit vs. 64-bit version of Windows XP, given that Python itself was
built on/for a 32-bit system?

I hoped sys.getwindowsversion() was the answer, but it returns the same
platform value (2) on both 32-bit and 64-bit systems.  sys.platform
("win32") and sys.maxint are both set at compile time.  Things like
os.uname() aren't on Windows.

Can some Windows-savvy Pythonista point me to some way to distinguish
between these two?

Thanks,

 --SK
--
http://mail.python.org/mailman/listinfo/python-list




I really don't think it matters too much which one you have, I have 64 bit 
and it works fine.


-Ivan

_
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


-- 
http://mail.python.org/mailman/listinfo/python-list

RE: help

2005-06-08 Thread Ivan Shevanski




-Ivan




>From: [EMAIL PROTECTED]
>To: python-list@python.org
>Subject: help
>Date: Thu, 2 Jun 2005 11:11:41 EDT
>
>When i try to open IDLE(python GUI) it says that i have a socket error:
>conection refused what do  i do to fix this
>--

Reinstall my friend. . .Reinstalling is the cure for everything. . .

-Ivan

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: SMTP help please

2005-06-07 Thread Ivan Shevanski


>From: Larry Bates <[EMAIL PROTECTED]>
>To: Ivan Shevanski <[EMAIL PROTECTED]>
>Subject: Re: SMTP help please
>Date: Tue, 07 Jun 2005 07:39:01 -0500
>
>I have found that the SmtpWriter class "hides" all the
>complexity in creating emails like you want to send.
>
>Check it out here:
>
>http://motion.sourceforge.net/related/send_jpg.py

This is good, but I don't want to send pictures and I don't know what to 
take out so it doesnt send pictures.  I fooled around with it a little bit 
and kept getting this error:

Traceback (most recent call last):
File "mail.py", line 119, in ?
  writer.sendMessage()
File "mail.py", line 94, in sendMessage
 aList = self.getImages()
File "mail.py", line 90, in getImages
 attachList  =  os.listdir(self.__imageDir)
AttributeError: SmtpWriter instance has no attribute '_SmtpWriter__imageDir'


So. . .it was good but i still can't get it to work. . .Can you help?
-Ivan

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help with SMTP

2005-06-07 Thread Ivan Shevanski
Ok, all my problems are solved except for one. . .If I want my program to 
send a message back to me do I need the from adress? Because I don't 
specifically know it for the person using the program.  Any help is 
appreciated =D




-Ivan

_
FREE pop-up blocking with the new MSN Toolbar – get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


-- 
http://mail.python.org/mailman/listinfo/python-list

SMTP help please

2005-06-06 Thread Ivan Shevanski
I really can't figure out anything about the SMTP module. . .I think I'm in 
over my head( Im pretty new to python).  Can someone show me a really(and I 
mean REALLY) basic tutorial for smtp or explain it?


program:
I want to make my program have a feedback form attached to it at the end 
which sends me the form when they're done.  I don't especially want them to 
have to input all the needed details though. . .Just thought I'd put this in 
so you'd know what its for.




-Ivan

_
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


-- 
http://mail.python.org/mailman/listinfo/python-list

Re: help with sending mail in Program

2005-06-06 Thread Ivan Shevanski
Could someone send me a good tutorial for sending mail then? The one I found 
is not what I'm looking for.  Also please dont send me the stmp definition 
cause i've looked at that enough.

thanks,
-Ivan

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help with sending mail in Program

2005-06-06 Thread Ivan Shevanski
Ugh. . .I'm really confused.  In the example I saw the message was taken 
from a file on the computer. . .Like it opened it and then sent it.  I guess 
I just need to check out the whole thing a bit more before I get specific. 
I'll ask again if I need specific help.


thanks,
-Ivan

_
FREE pop-up blocking with the new MSN Toolbar – get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Creating file of size x

2005-06-06 Thread Ivan Shevanski
http://python.org/doc/2.4.1/modindex.html

this is the global module index.  I'd keep it handy to search through since 
it has some of the most useful stuff every intented! =D Try looking through 
here to help. . .That's the best I can think of.

-Ivan

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Creating file of size x

2005-06-06 Thread Ivan Shevanski
What version of python do you use? I'll send you the module library. . 
.(sorry for double message)


-Ivan

_
FREE pop-up blocking with the new MSN Toolbar – get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Creating file of size x

2005-06-06 Thread Ivan Shevanski

> > Can you elaborate more? Just any file?
>
>Yes -- a binary file.
>
>The file will contain check blocks for another file. The problem is
>that the order of the received check blocks is not specified, so I need
>to be able seek to the block's position in the file, and then just write
>the block.
>
>--
>Kind Regards,
>Jan Danielsson
>Nobody loves a cynic
><< signature.asc >>
I don't know. . .have you searched through modules? That's all I can think 
of. . .

-Ivan

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

-- 
http://mail.python.org/mailman/listinfo/python-list


help with sending mail in Program

2005-06-06 Thread Ivan Shevanski

Hey i'm new here and relatively new to python.  I've made a few small 
programs and now I'm making a program for my friends that at the end has a 
feedback form.  I want to send the feedback back to my email adress.  I know 
I should use the SMTP module and I have figured out how to send with it, but 
I can't figure out how to include my variables in it, such as the questions 
I ask them.  Can someone explain this to me?
-Ivan

_
On the road to retirement? Check out MSN Life Events for advice on how to 
get there! http://lifeevents.msn.com/category.aspx?cid=Retirement

-- 
http://mail.python.org/mailman/listinfo/python-list