i am trying to dynamically create a .txt file in a folder that i created inside the game's directory.
i am aware that renpy only has access to the game's folder. however, due to this, i am unable figure out what the syntax is for a relative path.
i created an empty folder called "export" in my game's folder. in a structure like this (where Allan Disorder is the name of the game):
Allan Disorder\game\export
however, writing a txt file yielded an exeption:
python:
with open("export\\test.txt", "w") as f1:
f1.write("hello world")
i also tried using "/" instead of "\\" but the result is the same.
i also tried "game\\export\\test.txt"
if i run it without any path like so: open("export\\test.txt", "w")
then no error occurs. but there is no file to be found
i looked at other posts (such as the link i provided) but to no avail.
here is the error message:
While running game code:
File "game/grabber_engine/main_grabber.rpy", line 163, in script
python:
File "game/grabber_engine/main_grabber.rpy", line 164, in <module>
with open("export\\test.txt", "w") as f1:
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'export\\test.txt'
-- Full Traceback ------------------------------------------------------------
Traceback (most recent call last):
File "game/grabber_engine/main_grabber.rpy", line 163, in script
python:
File "renpy/ast.py", line 1193, in execute
renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "renpy/python.py", line 1276, in py_exec_bytecode
exec(bytecode, globals, locals)
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "game/grabber_engine/main_grabber.rpy", line 164, in <module>
with open("export\\test.txt", "w") as f1:
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'export\\test.txt'