tonywhitley / pyrfactor2sharedmemory Goto Github PK
View Code? Open in Web Editor NEWPython library for accessing rFactor 2's shared memory
License: MIT License
Python library for accessing rFactor 2's shared memory
License: MIT License
py -3.7 .\sharedMemoryAPI.py
Traceback (most recent call last):
File "C:\Users\erikm\AppData\Local\Programs\Python\Python37-32\lib\site-packages\psutil\_common.py", line 449, in wrapper
ret = self._cache[fun]
AttributeError: _cache
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\erikm\AppData\Local\Programs\Python\Python37-32\lib\site-packages\psutil\_pswindows.py", line 679, in wrapper
return fun(self, *args, **kwargs)
File "C:\Users\erikm\AppData\Local\Programs\Python\Python37-32\lib\site-packages\psutil\_common.py", line 452, in wrapper
return fun(self)
File "C:\Users\erikm\AppData\Local\Programs\Python\Python37-32\lib\site-packages\psutil\_pswindows.py", line 766, in exe
exe = cext.proc_exe(self.pid)
PermissionError: [WinError 24] The program issued a command but the command length is incorrect: '(originated from NtQuerySystemInformation)'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ".\sharedMemoryAPI.py", line 336, in <module>
test_main()
File ".\sharedMemoryAPI.py", line 236, in test_main
info = SimInfoAPI()
File ".\sharedMemoryAPI.py", line 32, in __init__
self.__find_rf2_pid()
File ".\sharedMemoryAPI.py", line 100, in __find_rf2_pid
if p.name().lower().startswith('rfactor2.exe'):
File "C:\Users\erikm\AppData\Local\Programs\Python\Python37-32\lib\site-packages\psutil\__init__.py", line 630, in name
name = self._proc.name()
File "C:\Users\erikm\AppData\Local\Programs\Python\Python37-32\lib\site-packages\psutil\_pswindows.py", line 750, in name
return os.path.basename(self.exe())
File "C:\Users\erikm\AppData\Local\Programs\Python\Python37-32\lib\site-packages\psutil\_pswindows.py", line 681, in wrapper
raise convert_oserror(err, pid=self.pid, name=self._name)
psutil.AccessDenied: psutil.AccessDenied (pid=2336)
This is on Win11 x64. Running rF2data.py
works fine, though.
3.7 went EOL as a net-new install and is essentially only available in latest releases as a source download.
3.10 and 3.11 are the only current releases for net-new binary installs on Windows. However, the current requirements fail to build against 3.11 as typed-ast
is part of Python now, so that install blows up.
Hi @TonyWhitley ,
is it possible to read data from the dedicated server?
I changed the process name to "rfactor2 dedicated.exe" in __find_rf2_pid()
and isRF2running()
but I get "rFactor 2 Shared Memory not present." and "Incorrect shared memory".
Server only is running for sure.
Does the rF2SharedMemoryMapPlugin by TheIronWolfModding map data from the dedicated server at all? I set DedicatedServerMapGlobally
to 1 in CustomPluginVariables.json
Can you help me please to figure out how I could use your python implementation to read telemetry from dedicated server?
Thank you and a merry x-mas!
Frey
python ./sharedMemoryAPI.py
Traceback (most recent call last):
File "./sharedMemoryAPI.py", line 336, in <module>
test_main()
File "./sharedMemoryAPI.py", line 236, in test_main
info = SimInfoAPI()
File "./sharedMemoryAPI.py", line 30, in __init__
rF2data.SimInfo.__init__(self)
File "/home/thoraxe/Red_Hat/openshift/pyRfactor2SharedMemory/rF2data.py", line 697, in __init__
self._rf2_tele = mmap.mmap(0, ctypes.sizeof(rF2Telemetry), "$rFactor2SMMP_Telemetry$")
TypeError: an integer is required (got type str)
Exception ignored in: <function SimInfoAPI.__del__ at 0x7fce248744d0>
Traceback (most recent call last):
File "./sharedMemoryAPI.py", line 211, in __del__
self.close()
File "./sharedMemoryAPI.py", line 204, in close
self._rf2_tele.close()
AttributeError: 'SimInfoAPI' object has no attribute '_rf2_tele'
Similarly:
python rF2data.py
Traceback (most recent call last):
File "rF2data.py", line 718, in <module>
info = SimInfo()
File "rF2data.py", line 697, in __init__
self._rf2_tele = mmap.mmap(0, ctypes.sizeof(rF2Telemetry), "$rFactor2SMMP_Telemetry$")
TypeError: an integer is required (got type str)
Exception ignored in: <function SimInfo.__del__ at 0x7f17ee8c2cb0>
Traceback (most recent call last):
File "rF2data.py", line 714, in __del__
self.close()
File "rF2data.py", line 707, in close
self._rf2_tele.close()
AttributeError: 'SimInfo' object has no attribute '_rf2_tele'
It's not clear why or what's wrong.
python --version
Python 3.7.16
pip list
Package Version
----------------- -------
astroid 2.2.5
behave 1.2.6
colorama 0.4.1
isort 4.3.21
lazy-object-proxy 1.4.2
mccabe 0.6.1
parse 1.12.0
parse-type 0.4.2
pip 10.0.1
psutil 5.7.0
pylint 2.3.1
setuptools 39.0.1
six 1.12.0
typed-ast 1.4.0
wrapt 1.11.2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.