|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
weird email module problem
Hi folks,
this has been working for days then all of a sudden it doesnt Code:
#!/usr/bin/env python import email, sys msg = email.message_from_file(sys.stdin) print msg['from'] Now its tell me this? WTF AttributeError: 'module' object has no attribute 'message_from_file' something wierd going on here eh? |
|
#2
|
||||
|
||||
|
A simple question : did you upgrade your version of Python ? It seems, from what I've read, that from Python 2.2.1 and above the email module changed. That might be your problem, especially if it stopped suddendly functionning.
|
|
#3
|
|||
|
|||
|
Hi SolarBear,
nope didnt upgrade or anything ![]() only have ever installed python 2.2.3_2 for freebsd and its still whats there. its got my beat... |
|
#4
|
||||
|
||||
|
Hi sissy, try replacing sys.stdin with sys.stdin.read() and see if that helps. It's just one of those strange quirks, somone a little while ago had code that worked on min and stopped another. soon after he got other errors and finally reinstalled Python. What error message are you getting anyway?
Take care, Mark. |
|
#5
|
|||
|
|||
|
Hi Mark,
tried with .read() made no difference also uninstalled and reinstalled python same error, go figure? Traceback (most recent call last): File "./email.py", line 3, in ? import email File "./email.py", line 7, in ? msg = email.message_from_file(sys.stdin) AttributeError: 'module' object has no attribute 'message_from_file' kind regards... |
|
#6
|
||||
|
||||
|
sissy, try this:
Code:
tom@tigger tom $ python Python 2.2.2 (#1, Dec 15 2002, 20:08:05) [GCC 3.2.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import email >>> dir(email) ['__all__', '__builtins__', '__doc__', '__file__', '__name__', '__path__', '__version__', 'message_from_file', 'message_from_string'] >>> To see what's going on with the modue. |
|
#7
|
|||
|
|||
|
Hi Telex4,
well certainly there lies the problem but now the question is how to solve? >>> dir(email) ['__builtins__', '__doc__', '__file__', '__name__', 'fromaddr', 'line', 'msg', 'prompt', 'server', 'smtplib',] so very different, thanks |
|
#8
|
||||
|
||||
|
I have to admit that I haven't the slightest clue! You might try asking this on the newsgroup comp.lang.python where somebody might recognise what module you have. I looked on Google and that certainly wasn't any module I recognise!
Or you could reinstall just the email module / python to see if it overwrites that module with the "correct" email module? |
|
#9
|
||||
|
||||
|
self import
Hey telex, we solved the problem. Apparently the program was importing itself, being named email.py
![]() Mark. |
|
#10
|
||||
|
||||
|
Ah
you and your private solutions ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > weird email module problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|