Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old July 30th, 2003, 08:37 PM
sissy sissy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 29 sissy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 48 m 25 sec
Reputation Power: 0
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?

Reply With Quote
  #2  
Old July 30th, 2003, 09:55 PM
SolarBear's Avatar
SolarBear SolarBear is offline
onCsdfeu
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Canada
Posts: 100 SolarBear User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 7 m 43 sec
Reputation Power: 6
Send a message via ICQ to SolarBear Send a message via MSN to SolarBear
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.

Reply With Quote
  #3  
Old July 30th, 2003, 11:00 PM
sissy sissy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 29 sissy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 48 m 25 sec
Reputation Power: 0
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...

Reply With Quote
  #4  
Old July 31st, 2003, 06:30 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,529 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 17 h 19 m 5 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
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.

Reply With Quote
  #5  
Old July 31st, 2003, 08:31 AM
sissy sissy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 29 sissy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 48 m 25 sec
Reputation Power: 0
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...

Reply With Quote
  #6  
Old July 31st, 2003, 08:50 AM
telex4's Avatar
telex4 telex4 is offline
Wacky hack
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2001
Location: London, England
Posts: 512 telex4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 25 m 29 sec
Reputation Power: 8
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.

Reply With Quote
  #7  
Old July 31st, 2003, 09:01 AM
sissy sissy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 29 sissy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 48 m 25 sec
Reputation Power: 0
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

Reply With Quote
  #8  
Old July 31st, 2003, 09:20 AM
telex4's Avatar
telex4 telex4 is offline
Wacky hack
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2001
Location: London, England
Posts: 512 telex4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 25 m 29 sec
Reputation Power: 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?

Reply With Quote
  #9  
Old July 31st, 2003, 10:40 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,529 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 17 h 19 m 5 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
self import

Hey telex, we solved the problem. Apparently the program was importing itself, being named email.py

Mark.

Reply With Quote
  #10  
Old July 31st, 2003, 11:30 AM
telex4's Avatar
telex4 telex4 is offline
Wacky hack
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2001
Location: London, England
Posts: 512 telex4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 25 m 29 sec
Reputation Power: 8
Ah you and your private solutions

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > weird email module problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway