Forming a small python programming group

2013-05-09 Thread kreta06
Hi All,

I'm looking for one or two medium-advanced python programmers to
practice programming on a Windows 7 platform. In addition, any
interests in writing python code to query Microsoft SQL databases
(2005-2008) is also welcomed.

I've coded in python 2.7 and currently am trying to make the switch to
3.2 as there seem to be some changes to the syntax. I'm only available
on a weekend basis and occasionally some week days. Therefore, in
terms of output, probably  2-3 scripts per month. If you are
interested in working with me, please send me an email on similar
interests and we can start this next week.

Best regards,
Sue
-- 
http://mail.python.org/mailman/listinfo/python-list


Problem with running python cgi scripts through my browser

2012-04-20 Thread kreta06
Dear Python Tutors,

I am having problems trying to send an email (using the smtplib module ) to
send an email to myself over my browser using a python script, which is
being called by an html form that I have created. My python cgi script is
located in my cgi-bin directory, which I had made sure that in my httpd
configuration, I had added the python extensions so that it can be run as a
cgi script over my browser. If I run my python script directly on the
commandline, I am able to send an email to myself and receive it.
However, when I try to do the same and run it from my html form, it doesn't
work. I'm sure I'm missing something here, but just can't figure out what.
My suspicions could be that to send an email over the browser requires a
specific format, which I could not figure out.
Below is my cgi script and errors that I get when I run the cgi script.

Any help would be appreciated.

Many thanks,
Sue


-
my script:

import cgi
import string,sys
import smtplib
import cgitb
cgitb.enable()
sys.stderr = sys.stdout


def main():
print Content-type: text/html\n
form = cgi.FieldStorage()
if form.has_key(firstname) and form[firstname].value != :
result = pName:  + form[firstname].value +
pFavorite Color(s):  + form[colors].value + pFavorite Drinks(s): 
+ str(form.getlist(drinks)) + pEmail:  + form[email].value
return result
else:
print Please enter your firstname!


TEXT = main()


FROM = myem...@gmail.com
TO = myem...@gmail.com
SUBJECT = Second try

# Prepare actual message

message = \
From: %s
To: %s
Subject: %s

%s
 % (FROM,,.join(TO), SUBJECT, TEXT)

# Send the mail
server2 = smtplib.SMTP(localhost)
server2.sendmail(FROM, TO, message)
server2.quit()

-

Error  I get:

 /usr/lib/python2.6/cgitb.py:173: DeprecationWarning: BaseException.message
has been deprecated as of Python 2.6 value =
pydoc.html.repr(getattr(evalue, name))

*class 'socket.error'*Python 2.6.6: /usr/bin/python
Fri Apr 20 15:13:06 2012

A problem occurred in a Python script. Here is the sequence of function
calls leading up to the error, in the order they occurred.
  /var/www/cgi-bin/action.py in **()37
38 # Send the mail
39 server2 = smtplib.SMTP(localhost)
40 server2.sendmail(FROM, TO, message)
41 server2.quit()
 server2 *undefined*, *smtplib* = module 'smtplib' from
'/usr/lib/python2.6/smtplib.pyc', smtplib.*SMTP* = class smtplib.SMTP
/usr/lib/python2.6/smtplib.py in *__init__*(self=smtplib.SMTP instance,
host='localhost', port=0, local_hostname=None, timeout=object object)
  237 self.default_port = SMTP_PORT
   238 if host:
   239 (code, msg) = self.connect(host, port)
   240 if code != 220:
   241 raise SMTPConnectError(code, msg)
 code *undefined*, msg *undefined*, *self* = smtplib.SMTP instance, self.*
connect* = bound method SMTP.connect of smtplib.SMTP instance, *host* =
'localhost', *port* = 0   /usr/lib/python2.6/smtplib.py in
*connect*(self=smtplib.SMTP
instance, host='localhost', port=25)   293
 if not port: port = self.default_port
   294
 if self.debuglevel  0: printstderr, 'connect:', (host, port)
   295 self.sock = self._get_socket(host, port, self.timeout)
   296 (code, msg) = self.getreply()
   297 if self.debuglevel  0: printstderr, connect:, msg
 *self* = smtplib.SMTP instance, self.sock *undefined*, self.*_get_socket* =
bound method SMTP._get_socket of smtplib.SMTP instance, *host* =
'localhost', *port* = 25, self.*timeout* = object object
/usr/lib/python2.6/smtplib.py in *_get_socket*(self=smtplib.SMTP
instance, port='localhost', host=25, timeout=object object)   271
 # and just alter the socket connection bit.
   272
 if self.debuglevel  0: printstderr, 'connect:', (host, port)
   273 return socket.create_connection((port, host), timeout)
   274
   275 def connect(self, host='localhost', port = 0):
 *global* *socket* = module 'socket' from
'/usr/lib/python2.6/socket.pyc', socket.*create_connection* = function
create_connection, *port* = 'localhost', *host* = 25, *timeout* = object
object   /usr/lib/python2.6/socket.py in
*create_connection*(address=('localhost',
25), timeout=object object)   563 except error, msg:
   564 if sock is not None:
   565 sock.close()
   566
   567 raise error, msg
 *global* *error* = class 'socket.error', *msg* = error(13, 'Permission
denied')

*class 'socket.error'*: [Errno 13] Permission denied
  args = (13, 'Permission denied')
  errno = 13
  filename = None
  message = ''
  strerror = 'Permission denied'
-- 
http://mail.python.org/mailman/listinfo/python-list


Python exercise club

2012-04-20 Thread kreta06
Hi Python Programmers or Newbies,

I have just started a small group of python programmers (newbies and people
with intermediate python programming experience) to
develop and work weekly on a series of python exercises and come up with
solutions to these exercises I develop.
The aim is to improve our skills through interacting with other programmers
and eventually work on the development of
a python project where this work can be publicly displayed and hopefully
transition to a python developer level.
The interaction is important to share our knowledge and motivate each other
to learn. I normally send out an exercise every week and we have a deadline
for a week. At the moment, we are on our 4th exercise.

If any of you are interested, please send me an email if you would like to
participate.

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