Having a specific problem,

Is there a way to convert a file to a string, and then from a string to an integer, and then back to string in a normal way? I’ve found almost nothing about how to fix this error:

Traceback (most recent call last):
  File "start.py", line 59, in <module>
    execute = run_script[script]
KeyError: "<_io.TextIOWrapper name='events/input.txt' mode='r' encoding='UTF-8'>"

The only fixes to the problem created this error I’ve never seen before:

KeyError: ''

I’m literally having to use a ruby script, because I haven’t found any answers about how to fix the problem online.

In ruby, I can do the same thing by:

input = File.read("events/input.txt").strip.to_s

input = input + 1

open("events/input.txt", "w") { |f|
  f.puts input
}

But whenever I try the python3 equivalent, I get this error.