[Tutor] Silly directory problems...
D-Man
dsh8290@rit.edu
Thu, 11 Jan 2001 20:00:53 -0500
On Thu, Jan 11, 2001 at 07:34:12PM -0500, Joel Ricker wrote:
| I've got two problems but I think they are both connected to one another.
|
| The first is reading in a file. I want my data to be in a directory called
| dat located from the current directory (the one the script is running in).
| The directory is there and so is the file but:
|
| fhandle = open("/dat/game.dat","r")
^
I had the same silly typo in my procmailrc file that someone else on a
list pointed out to me.
You don't want that leading '/' for a relative path.
|
| doesn't work (file not found or similiar stated error).
|
| This works fine: fhandle = open("game.dat","r"). So I'm thinking I need to
| append the current directory before adding the /dat/ directory but I
| couldn't find where thats located.
|
| Also I created a module and when I first stared building it, I located just
| off one of the builtin module directories (I'm using activestate python so
| that directory is c:/python20/libs/) but when I moved it and tried to append
Oh, a Windows machine. That's a really interesting path syntax.
Could this be related to your above problem? The path you gave is
perfectly legal and normal for a Unix path. (those most systems don't
have a /dat directory by default)
| the directory, it still couldn't find it. I think I did manage to get it to
| find the modules but dir(module_name) didn't produce any of the subroutines
| or variables inside it. I moved the modules back to where it was working
| but I'm going to need my modules to be run-time specific.
|
| Any ideas? These are probably silly and I'm just missing something minor.
|
| Thanks for the help
| --
| Joel Ricker joejava@dragoncat.net Just Another Python Hacker
| =======================================================================
| I have been Perl-Free for 6 Days, 21 Hours, 34 Minutes, and 28 Seconds.
|
HTH,
-D