Re: email questions

2006-02-08 Thread Scott Frankel

Yes, I was doing something wrong:  I was connecting to the localhost  
after instantiation.  All better now.

Thanks for the tips!
Scott



On Feb 8, 2006, at 11:04 AM, Carsten Haese wrote:

>
> Then you're doing something wrong. The line
>
> s = smtplib.SMTP("mail.ispname.net") instantiates an SMTP instance and
> connects it. Are you doing s.connect() afterwards? If yes, don't do
> that, it'll try to connect to the local host, which is not an smtp
> server.
>
> If you want to separate instantiation and connection, do this:
>
> s = smtplib.SMTP()
> s.connect("mail.ispname.net")
>
> -Carsten
>
>

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


Re: email questions

2006-02-08 Thread Scott Frankel

Seems I'm still having issues with syntax.

 From what I can tell from my mail client, my outgoing mail server  
name is either

mail..net
or
mail..net:@.com

The former yields the same socket error on connect() that I reported  
earlier.  The latter yields a "nonnumeric port" error upon  
instantiation.  Instantiating with the port number,

s = smtplib.SMTP("mail..net:@.com",  
portNum)

yields the following error:

socket.gaierror: (7, 'No address associated with nodename')


Suggestions?

Thanks again
Scott




On Feb 8, 2006, at 9:47 AM, Carsten Haese wrote:

> On Wed, 2006-02-08 at 12:34, Scott Frankel wrote:
>> I'm looking for a way to send a simple, plain text email message
>> using Python.  My initial attempts are failing with the following  
>> error:
>>
>>  socket.error: (61, 'Connection refused')
>>
>> Does this imply that I do not have the machine's smtp server
>> running?
>
> Yes.
>
>>   (I don't; and I'd like to avoid setting it up.)
>
> You don't have to set up an smtp server to use smtplib. You should be
> able to use your ISP's outgoing mail server, as in
>
> s = smtplib.SMTP("")
>
> HTH,
>
> Carsten.
>
>
> -- 
> http://mail.python.org/mailman/listinfo/python-list

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


email questions

2006-02-08 Thread Scott Frankel

I'm looking for a way to send a simple, plain text email message  
using Python.  My initial attempts are failing with the following error:

socket.error: (61, 'Connection refused')

Does this imply that I do not have the machine's smtp server  
running?  (I don't; and I'd like to avoid setting it up.)

I'm following example code in the lib ref docs:

 >>> s = smtplib.SMTP()
 >>> s.connect()
Traceback (most recent call last):
   File "", line 1, in ?
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ 
python2.4/smtplib.py", line 303, in connect
 raise socket.error, msg
socket.error: (61, 'Connection refused')


Python 2.4.1
MacOSX 10.4.3


Is there a better/easier way to send a plain text message?

Thanks in advance!
Scott
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython vs. pyQt

2005-03-16 Thread Scott Frankel
I have just started using wxPython.  I selected it over pyQT for 
licensing
reasons.  I'm no gui app expert.  But that said, I've found the toolkit
approachable and the user community very helpful.

Scott

On Mar 16, 2005, at 9:11 PM, [EMAIL PROTECTED] wrote:
I've narrowed down my toolkit selection for my project to wxPython and
pyQt, and now i'd like to hear any opinions, war stories, peeves, etc,
about them, particularly from anyone who's used _both_toolkits_. I'm
only mildly interested in the IDEs and UI designers for each, as i
want to do as much as i can in just Xemacs and xterm. Feel free to
rant, rave, pontificate, whatever.
t.i.a.,
E
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list


Re: file descriptors & fdopen

2004-12-06 Thread Scott Frankel
foo = open('foo.txt', 'w')
duh.
Thanks -
Scott
On Dec 6, 2004, at 11:27 AM, Scott Frankel wrote:
Why does os.fdopen('foo.txt', 'w') require an integer?
Ultimately, I want to create a new file on disk.
Funny, I can't seem to suss-out how to create a new file without 
resorting
to os.system('touch foo.txt').  ... Or maybe not so funny ...

>>> foo = os.fdopen('foo.txt', 'w')
Traceback (most recent call last):
  File "", line 1, in ?
TypeError: an integer is required
Thanks in advance!
Scott

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


file descriptors & fdopen

2004-12-06 Thread Scott Frankel
Why does os.fdopen('foo.txt', 'w') require an integer?
Ultimately, I want to create a new file on disk.
Funny, I can't seem to suss-out how to create a new file without 
resorting
to os.system('touch foo.txt').  ... Or maybe not so funny ...

>>> foo = os.fdopen('foo.txt', 'w')
Traceback (most recent call last):
  File "", line 1, in ?
TypeError: an integer is required
Thanks in advance!
Scott

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


Re: knowing a file's own name

2004-11-29 Thread Scott Frankel
Thanks for the responses!
I'd forgotten about using the sys module:
import sys
filename = sys.argv[0]
Using "__file__" also works.
Thanks
Scott
On Nov 29, 2004, at 9:37 AM, Scott Frankel wrote:
I'm looking for a way to identify a filename remotely.  Put 
differently,
is there a way a file can get its own name from its globals()?

doit.py calls exec() on a second py script, tpairs.py, to obtain a 
dict of the
globals in tpairs.py.  How can I add the filename, "tpairs.py," to the 
resulting dict?
i.e.:

# - - - - - - - - - - - - - - - -
# -- tpairs.py
# - - - - - - - - - - - - - - - -
this  = "this"
that  = "that"
gdict = globals()
# - - - - - - - - - - - - - - - -
# -- doit.py
# - - - - - - - - - - - - - - - -
#!/usr/bin/env python
theFile = "./tpairs.py"
theDict = {}
execfile(theFile, theDict)
# somehow add theFile to gdict, i.e.:
# gdict['theFile'] = theFile
Thanks in advance!
Scott
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list


knowing a file's own name

2004-11-29 Thread Scott Frankel
I'm looking for a way to identify a filename remotely.  Put differently,
is there a way a file can get its own name from its globals()?
doit.py calls exec() on a second py script, tpairs.py, to obtain a dict 
of the
globals in tpairs.py.  How can I add the filename, "tpairs.py," to the 
resulting dict?
i.e.:

# - - - - - - - - - - - - - - - -
# -- tpairs.py
# - - - - - - - - - - - - - - - -
this  = "this"
that  = "that"
gdict = globals()
# - - - - - - - - - - - - - - - -
# -- doit.py
# - - - - - - - - - - - - - - - -
#!/usr/bin/env python
theFile = "./tpairs.py"
theDict = {}
execfile(theFile, theDict)
# somehow add theFile to gdict, i.e.:
# gdict['theFile'] = theFile
Thanks in advance!
Scott
--
http://mail.python.org/mailman/listinfo/python-list