Strdate / PythonConsole

Cities Skylines mod
25 stars 4 forks source link

functions/variables not updating #9

Open VirtualCartographer opened 2 years ago

VirtualCartographer commented 2 years ago

I have altered a function in python on my computer, and pasted the altered function into the C:S Python Console. However, the Python console outputs the same value as the old version of the function, even after I hit Reset.

I wondered if the function was not redefined somehow, so I hit the console "reload button". I did not rename other functions or variables in the document which the function I called had dependencies on. How to get my new C:S Python Console document to really update?

Strdate commented 2 years ago

Well, I can't help you with that unless you provide the code. But if the console dies and you hit Reset, a fresh instance of Python loads, so that has an opposite effect than you want.

VirtualCartographer commented 2 years ago

I figured out the issue, I had to do:

from __future__ import division

to get floating point numbers. What version of python is the plugin built on?

HuangFuSL commented 2 years ago

I think it's Python 2.7.

You can check it manually by executing the following code:

import sys
print(sys.version_info)
# For Python 2.7 it should be:
# sys.version_info(major=2, minor=7, micro=11, releaselevel='final', serial=0)