ERROR: how to use a text file in a module?

Moni GV tamuzija at yahoo.es
Thu Jun 18 14:57:46 EDT 2009


Hi,

Help with a "No such file ..." error. I have the next folder structure:
---Network contains:
    --packets.py
    --Temp contains:
       -test.py

Well, within packets.py I do this:
from Temp.test import *

Within test.py I do this:
f = open ("topo.txt", "r")

The error is:
No such file "topo.txt"

However, when I execute test.py, without using neither packets.py nor the folder structure, there is no error, because topo.txt exists.

I'm sure I'm doing something wrong with the "import" staff or "path" maybe, but have no idea...please help!!!

Thanks in advance!

**
Mónica Guerrero
M.Sc. Student
Rey Juan Carlos University
Madrid




      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090618/3df7b279/attachment.html>


More information about the Python-list mailing list