Re: [Tutor] What language should I learn after Python?

2009-10-06 Thread root
Want another functional language besides scheme? Haskell.

It looks pretty cool, and I want to learn it too.

Here's some resources:

A speach about haskell
http://www.infoq.com/interviews/armstrong-peyton-jones-erlang-haskell

Beginner's book
http://learnyouahaskell.com/introduction

Another book
http://book.realworldhaskell.org/
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] create new user

2008-04-07 Thread root
Hi All.

Hope you are Good and Doing Well.I am Working on a web based
application .I need your pretty help for this all as I have to work in
Python and I am New to this..
  I want to write a python script in which will create a new user and
 password.please tell me ,how it will be passible???
I googled for this but could not find any good solution .At present
 I am using a shell script that create new user and this script is
called in python .
  Would you please suggest me python code that create new user.


  waiting for your's reply

  regards
Jatinder


The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.

www.wipro.com

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor Digest, Vol 51, Issue 23

2008-05-11 Thread root
Hi ,
I AM TRYING FOR A PYTHON PROGRAM THAT WILL CHECK WHETHER {- PHP AND
MYSQL -} ARE INSTALLED ON lINUX OR NOT AND IF THEY ARE NOT INSTALLED
THEN THE SCRIPT WILL TO INSTALL IT.

for this I am doing

import sys
import os
import commands
import sys


commands_hash = {}
commands_hash['php'] = {}
commands_hash['php']['title'] = "***PHP**"
commands_hash['php']['value'] = "rpm -qa *php*"
commands_hash['mysql'] = {}
commands_hash['mysql']['title'] = "***MYSQL**"
commands_hash['mysql']['value'] = "rpm -qa *mysql*"


this is checking whether PHP and MYSQL are installed but PLEASE TELL ME
HOW TO ENHANCE IT SO AS THE INSTALL IT IF NOT INSTALLED ALREADY.

Thanks

Jatinder Singh


On Sun, 2008-05-11 at 12:00 +0200, [EMAIL PROTECTED] wrote:
> Send Tutor mailing list submissions to
>   tutor@python.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>   http://mail.python.org/mailman/listinfo/tutor
> or, via email, send a message with subject or body 'help' to
>   [EMAIL PROTECTED]
> 
> You can reach the person managing the list at
>   [EMAIL PROTECTED]
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Tutor digest..."
> 
> 
> Today's Topics:
> 
>1. Logging module (Dick Moores)
>2. Re: Logging module (Martin Walsh)
>3. Re: Logging module (Dick Moores)
> 
> 
> --
> 
> Message: 1
> Date: Sat, 10 May 2008 06:36:53 -0700
> From: Dick Moores <[EMAIL PROTECTED]>
> Subject: [Tutor] Logging module
> To: Python Tutor List 
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="us-ascii"; format=flowed
> 
> I don't understand how to use this. I've read 
>  and 
> .
> 
> I thought I'd try with a script that screws up:
> 
> a = "qwerty"
> b = a*b
> 
> But how to use the logging module to log the report of the screw up? 
> Right now I don't care about the various levels. I just want to get 
> something into a log file.
> 
> Hellmann suggest this:
> 
> import logging
> LOG_FILENAME = '/tmp/logging_example.out'
> logging.basicConfig(filename=LOG_FILENAME, level=logging.DEBUG,)
> logging.debug('This message should go to the log file')
> 
> But where to put it? In my above script?
> 
> Thanks,
> 
> Dick Moores
> 
> 
> 
> 
> --
> 
> Message: 2
> Date: Sat, 10 May 2008 16:03:20 -0500
> From: Martin Walsh <[EMAIL PROTECTED]>
> Subject: Re: [Tutor] Logging module
> To: "tutor@python.org" 
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=ISO-8859-1
> 
> Dick Moores wrote:
> > But how to use the logging module to log the report of the screw up?
> > Right now I don't care about the various levels. I just want to get
> > something into a log file.
> > 
> > Hellmann suggest this:
> > 
> > import logging
> > LOG_FILENAME = '/tmp/logging_example.out'
> > logging.basicConfig(filename=LOG_FILENAME, level=logging.DEBUG,)
> > logging.debug('This message should go to the log file')
> > 
> > But where to put it? In my above script?
> 
> I usually wrap up code in a try except and use the logging.exception
> method, which is shorthand for logging.error(msg, exc_info=1), to
> include the traceback. Something like this:
> 
> import logging
> LOG_FILENAME = '/tmp/logging_example.out'
> logging.basicConfig(filename=LOG_FILENAME, level=logging.DEBUG)
> 
> def main():
> a = "qwerty"
> b = a * b
> 
> try:
> main()
> except:
> logging.exception('unknown')
> raise
> 
> HTH,
> Marty
> 
> 
> 
> --
> 
> Message: 3
> Date: Sat, 10 May 2008 17:08:18 -0700
> From: Dick Moores <[EMAIL PROTECTED]>
> Subject: Re: [Tutor] Logging module
> To: "tutor@python.org" 
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="us-ascii"; format=flowed
> 
> At 02:03 PM 5/10/2008, Martin Walsh wrote:
> >Dick Moores wrote:
> > > But how to use the logging module to log the report of the screw up?
> > > Right now I don't care about the various levels. I just want to get
> > > something into a log file.
> > >
> > > Hellmann suggest this:
> > >
> > > import logging
> > > LOG_FILENAME = '/tmp/logging_example.out'
> > > logging.basicConfig(filename=LOG_FILENAME, level=logging.DEBUG,)
> > > logging.debug('This message should go to the log file')
> > >
> > > But where to put it? In my above script?
> >
> >I usually wrap up code in a try except and use the logging.exception
> >method, which is shorthand for logging.error(msg, exc_info=1), to
> >include the traceback. Something like this:
> >
> >import logging
> >LOG_FILENAME = '/tmp/logging_example.out'
> >logging.basicConfig(filename=LOG_FILENAME, level=logging.DEBUG)
> >
> >def main():
> > a = "qwerty"
> > b = a * b
> >
> >try:
> > 

[Tutor] checking and installing dependent softwares

2008-05-11 Thread root
Hi ,
i am trying for a python script that is to check the php5 and
mysql softwares.If the php5 and mysql softwares are not installed, the
should provide a way to list down / install the software. 


please guide me to do this.- 

for this I am doing

import sys
import os
import commands
import sys


commands_hash = {}
commands_hash['php'] = {}
commands_hash['php']['title'] = "*PHP**"
commands_hash['php']['value'] = "rpm -qa *php*"
commands_hash['mysql'] = {}
commands_hash['mysql']['title'] ="MYSQL**"
commands_hash['mysql']['value'] = "rpm -qa *mysql*"


this is checking whether PHP and MYSQL are installed but how to enhance
it so as to install them.


Thanks

Jatinder Singh


On Sun, 2008-05-11 at 17:07 +0530, "शंतनू महाजन (Shantanoo
Mahajan)" wrote:
> Hi Jatinder,
> Please turn off caps lock.
> On 11-May-08, at 4:54 PM, root wrote:
> 
> > Hi ,
> > I AM TRYING FOR A PYTHON PROGRAM THAT WILL CHECK WHETHER {- PHP AND
> > MYSQL -} ARE INSTALLED ON lINUX OR NOT AND IF THEY ARE NOT INSTALLED
> > THEN THE SCRIPT WILL TO INSTALL IT.
> >
> > for this I am doing
> >
> > import sys
> > import os
> > import commands
> > import sys
> >
> >
> > commands_hash = {}
> > commands_hash['php'] = {}
> > commands_hash['php']['title'] = "***PHP**"
> > commands_hash['php']['value'] = "rpm -qa *php*"
> > commands_hash['mysql'] = {}
> > commands_hash['mysql']['title'] = "***MYSQL**"
> > commands_hash['mysql']['value'] = "rpm -qa *mysql*"
> >
> >
> > this is checking whether PHP and MYSQL are installed but PLEASE TELL  
> > ME
> > HOW TO ENHANCE IT SO AS THE INSTALL IT IF NOT INSTALLED ALREADY.
> 
> Please check '-i' and '-U' options of rpm command.
> 
> regards,
> shantanoo


Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email. 

www.wipro.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] (no subject)

2008-05-15 Thread root
hi ,i am working to replace three lines in a httpd.conf file using
regular expression.i am able to change only one among them but while
replacing other i am not geeting good idea to replace all the three
lines just in a single script ,,my script is like

 #!usr/bin/python

import sys
import os
import re
import  string

def replace_file(file,search,replace):
cregex=re.compile(search)
for current_line in file:
if cregex.search(current_line):
current_line=re.sub(search,replace,current_line)
print current_line
else:
print current_line


def main():
file =open("/root/Desktop/httpd.conf").readlines()
replace_file(file,'User apache ' , 'User myuser ')
#replace_file(file,'Group apache','Group myuser')
#replace_file(file,DirectoryIndex\ index.html\ 
index.html.var,DirectoryIndex\ index.html\ index.html.var\ login.html)



if __name__ == '__main__':
main()


I am running this command to save the output in a temp file then replacing with 
original httpd.conf.

can I do this in a single python script that'll change three lines and 
there should not any need to replace it.that is the change should
 directly save to the source file..??

any help will be appreciated.Thanks


Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email. 

www.wipro.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor