Embarassingly Simple Issue (Solved...)

Ok… I feel like a total idiot for having to ask this.

I had a completely ingenious idea last night, to generate EGG files by modifying a base egg file of a cube. I manually screwed with the EGG file until I understood the format well, and made a program to change how high each corner of the cube is, in order to be used as terrain by a random terrain generator. (Brilliant, no? xD)

Anywho, upon trying to write the output of this lovely little script, I am presented with a stupid Errno 2:

Here’s my code:

fn="terrain\terrain-"+str(c1)+"-"+str(c2)+"-"+str(c3)+"-"+str(c4)+".egg"
op=file(fn,"w")
op.writelines(mesh)

Ironically, there is a nearly identical piece of code reading the template mesh from the same folder, except in read mode. Should not the “w” argument make it create the file if not present!?

Read this on the Panda Filename Syntax:
panda3d.org/manual/index.php/Loading_Models
Use a / instead of a .

This isn’t even a panda script though, just straight python! This is completely separate from my game…

In that case, you should double the backslash, because in Python (like in C) a single backslash is an escape character. Or, just use a forward slash anyway (Windows understands forward slashes just fine).

David

Ah yeah, that’s why… It’s been a long time since I dealt with external files in python, rofl.

I’m not some python nub either, been doing this for some time…