Apps upgrading Python in AC

barf

25RPM
Oct 1, 2017
45
56
Has anyone tried to upgrade Python in AC? Did you have any success?

I need to upgrade the interpreter DLL and distribution in:
Code:
assettocorsa\system\x64
Version 3.3.5 is pretty old (March 2014) and I need to use asyncio in this app I'm working on :-/
 
Nov 18, 2013
704
372
you cant just update it, its edited to fit ac's needs
write code that interacts with a dll that makes what you need
 

barf

25RPM
Oct 1, 2017
45
56
you cant just update it, its edited to fit ac's needs
write code that interacts with a dll that makes what you need
that doesn't make sense, but too late I upgraded the interpreter to 3.7 anyway. it's working OK but need to fix socket communication, and some other broken site packages because the sys.path is wierd in this environment
 
Nov 18, 2013
704
372
yeah they all must differentiate btw 32/64bit using whether stdlib\_ctypes.pyd or stdlib64\_ctypes.pyd (which you must include yourself, it's in nearly every ac-app)

if platform.architecture()[0] == "64bit":
dllfolder = "stdlib64"
else:
dllfolder = "stdlib"
cwd = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(cwd, dllfolder))



userDir=''
CSIDL_PERSONAL = 5 # My Documents
SHGFP_TYPE_CURRENT = 0 # Get current, not default value
buf = ctypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH)
ctypes.windll.shell32.SHGetFolderPathW(None, CSIDL_PERSONAL, None, SHGFP_TYPE_CURRENT, buf)
userDir = buf.value # bingo, userdir/documents!
 
  • Like
Reactions: barf

barf

25RPM
Oct 1, 2017
45
56
thanks dude, already past that point (including _ctypes.pyd and _socket.pyd amongst other things)

i shoehorned the python 3.7 dist zip and dll in there. if you rename it to python33.zip and the dll to python33.dll it can be upgraded, AC is just loading the python interpreter by it's string name apparently. not sure what is special about this interpreter, if anything...

so 3.7.4 is working in AC but to get any useful apps working i need the AC shared memory interface to work (ac_values_lib/stdlib/whatever), which means ctypes must load, but the import is failing because a DLL required by ctypes isn't in the search path apparently... just a problem to solve between chair and keyboard now i think :)
 
Last edited:
  • Like
Reactions: Please Stop This

jars121

1RPM
Aug 23, 2019
1
0
31
Any chance you could shed some light on how you addressed _ctypes barf? I'm running the stock 3.3.5 but am getting the ERROR LOADING MODULE: sys.path.append('apps/python/appName') error, despite using the various 32/64-bit checks and including the _ctypes.pyd files in the path.

EDIT: Never mind, about 3 minutes after posting I got it working. In the end it looks like the _ctypes.pyd files I had weren't quite right; I downloaded a known working app and used their _ctypes.pyd files and it fixed the issue.
 
Last edited: