Newbie need help

Marco Guidi ENONMELOSPAMMATEguidi at sssup.it
Wed Oct 20 05:49:52 EDT 1999


I've a very silly problem, but I'm not able to solve it.

I have a directory called Zope/lib/python/App and
a directory called Zope/lib/python/DocumentTemplate.

In the former there's a Common.py file, among the others.
In the latter there's a DocumentTemplate.py file.

I enter the Zope/lib/python directory and run python.
I do the following:

[www at link python]$ python
Python 1.5.1 (#1, Sep  3 1998, 22:51:17)  [GCC 2.7.2.3] on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import DocumentTemplate
>>> import Common
Traceback (innermost last):
  File "<stdin>", line 1, in ?
ImportError: No module named Common
>>> dir (DocumentTemplate)
['DT_HTML', 'DT_Return', 'DT_String', 'DT_Util', 'DT_Var',
'DocumentTemplate', 'ExtensionClass', 'File', 'HTML', 'HTMLDefault',
'HTMLFile', 'String', 'VSEval', '__builtins__', '__doc__', '__file__',
'__name__', '__path__', '__version__', 'html_quote',
'pDocumentTemplate',
'ts_regex']
>>>

Why did I get the error

Traceback (innermost last):
  File "<stdin>", line 1, in ?
ImportError: No module named Common ?

and Why could I import DocumentTemplate correctly ?

Which is the correct way for importing a file residing in
some directory different from the one from wich I run python
(and different from Extensions or other predefined directories) ?

In the Python tutorial dowloaded from www.python.org I found no
infos about this.

Thank you in advance.

Marco Guidi.





More information about the Python-list mailing list