[Tutor] import calendar not working

Harold Weaver hweaver@pdx.oneworld.com
Tue, 26 Oct 1999 16:18:57 +0000


These both work the same for me using Python 1.5.2 and idle on Win98.  Also
from command line.

-- Hal


Michael Perry wrote:

> 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
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://www.python.org/mailman/listinfo/tutor