[reportlab-users] n00b Python Question

Robin Becker robin at reportlab.com
Thu Jan 18 17:47:01 EST 2007


McPhilamy, Chris- PD wrote:


Chris, the error message indicates that the reportlab folder is not on
the PYTHONPATH.

There are several ways to get reportlab on the PYTHONPATH. Among them are

1) put the folder that contains reportlab on the PYTHONPATH environment
variable

eg

set PYTHONPATH=c:\folder

where c:\folder\reportlab is our code.

2) Move the reportlab folder to the python site-packages folder. On
windows the command

python -c "import sys;print sys.exec_prefix"

indicates where the python exe lives. The site-packages folder is

exec_prefix folder\Lib\site-packages.

If the reportlab top level folder is in the site-packages folder then
reportlab should be visible.

3) Use a python .pth file. This is a text file that contains extra
python paths. It can be anywhere that is already on the python path. In
my case I use the folder from

python -c "import sys;print sys.exec_prefix"

(in my case c:\Python). I have a text file called RGB.pth in that
folder. It contains a single line

c:\code

which means that C:\code is on the PYTHONPATH. My working copy of
reportlab is c:\code\reportlab

I hope this helps.

> Your help is much appreciated!

>

> I know a little about whats going on in Python but can seem to figure out

> why I cant the step 8 test to work.

>

> Open up a MS-DOS command prompt and CD to "..\reportlab\test". On NT, enter

> "test_pdfgen_general.py"; on Win9x, enter "python

> test_pdfgen_general.py". After a couple of seconds, the script completes and

> the file

> test_pdfgen_general.pdf should be ready

> This is located in the userguide. I cant seem to get it to run in the cmd

> and in the python GUI it gives me the following error.

>

>

> C:\Python25\reportlab_2_0\reportlab\test>python test_pdfgen_general.py

> Traceback (most recent call last):

> File "test_pdfgen_general.py", line 11, in <module>

> from reportlab.test import unittest

> ImportError: No module named reportlab.test

>

> For some reason reportlab.test one work and I cant find it anywere. Any

> ideas? What am I over looking?

>

> Thank you,

>

> Chris McPhilamy


--
Robin Becker


More information about the reportlab-users mailing list