[Tutor] import calendar not working

Michael Perry vball@erols.com
Tue, 26 Oct 1999 13:06:53 -0400


I can't figure out why this works:

The filename is "cal.py"
#!/usr/bin/python

print "Content-type: text/html" # HTML is following
print                           # blank line, end of headers

import sys
# import calendar

print sys.path
# calendar.prmonth(1999, 10)

$ ./cal.py
Content-type: text/html

['.', '/usr/lib/python1.5/', '/usr/lib/python1.5/test',
'/usr/lib/python1.5/plat-linux-i386', '/usr/lib/python1.5/lib-tk',
'/usr/lib/python1.5/lib-dynload', '/usr/lib/python1.5/site-packages',
'/usr/lib/python1.5/site-packages/HTMLgen',
'/usr/lib/python1.5/site-packages/NumPy',
'/usr/lib/python1.5/site-packages/PIL',
'/usr/lib/python1.5/site-packages/idle']
[mike@spin cgi-bin]$


And this does not work?:

#!/usr/bin/python

print "Content-type: text/html" # HTML is following
print                           # blank line, end of headers

import sys
import calendar

print sys.path


$./cal.py
Content-type: text/html

Traceback (innermost last):
  File "./cal.py", line 8, in ?
    import calendar
  File "/home/httpd/cgi-bin/calendar.py", line 15, in ?
    import HTMLcalendar
  File "/usr/lib/python1.5/site-packages/HTMLgen/HTMLcalendar.py", line
25, in ?
    from calendar import day_name, month_name, mdays, weekday
ImportError: cannot import name day_name
[mike@spin cgi-bin]$ pwd
/home/httpd/cgi-bin