michael montagne writes:
I'm trying to use the HTMLcalendar.py as an external function. The supported files are these: import string, time from HTMLcolors import * from HTMLgen import SimpleDocument, TableLite, TD, TR, Font, Name, H, Center, Href from types import IntType from calendar import day_name, month_name, mdays, weekday
I placed HTMLcolors.py, HTMLgen.py, and HTMLcalendar.py in a Website/Extensions folder on my hard drive. Not in the extensions folder I made thru the Zope interface. When I try and add an external method, specifying HTMLcalendar, i get an error telling me that HTMLcolors can't be found. What is the proper way to reference multiple files like this? Is this the proper way to use HTMLgen? You must make sure that your modules are found via the Python path mechanism.
You may extend "PYTHONPATH" to include the directory, where you have placed your modules. However, I would follow a DC recommendation: Create a subfolder "<company_name>" in the directory ".../lib/python/Shared" and place your company specific infrastructure there (maybe in subfolders). From Python, you would access it by: form Share.<company_name> import .... i.e. as a Python package. Do not forget, to provide a "__init__.py" file in each package directory. It may be empty. Dieter