I’ve created a plugin for rFactor that forwards plugin calls to Python scripts, making the task of programming for rFactor much easier. Python is loaded with tons of useful modules (urllib2 and serial, for example) ready to use, and their documentation is very, very good.
Using the plugin is simple as placing its .dll in rfactor/Plugins and rfactor.py in rfactor/.
Python (2.7 at the moment) is the only requirement.
rfactor.py is a simple demonstration but also serves as the plugin’s documentation.
Let me illustrate some cases. You can:
- update a database with players timings every 30 seconds
- create a webpage with live server status (like this one)
- transmit telemetry data over a serial connection (ex. to an Arduino)
- send an email, with results, after a race ends
Of course, all of these examples are possible with C++ plugins, but doing them in Python is incredibly more friendly.
It’s just a matter of editing rfactor.py! No compiling!
Possibilities are many and if you’re using this plugin in a project, I’d be happy to know about it.
i installed “python-2.7.2″ , “mysql-installer-5.5.19.0″, “MySQL-python-1.2.3.win32-py2.7″
I created a schema for rfactor and opened “rfactor-mysqldb.sql” and execute the query. The session and timing tables are created.
then put the sql and plugin file to py plugin folder
But rfactor not starts it gives the below error.
Error is :
APPCRASH
rFactor.exe
1.2.5.5
4705a035
python27.dll
2.7.2150.1013
4df4ba7c
c0000005
000a1d97
6.1.7600.2.0.0.256.1
1055
0a9e
0a9e372d3b4ad19135b953a78882e789
0a9e
0a9e372d3b4ad19135b953a78882e78
Hi.
When you say python 2.7.2, is it the 32bit version?
Can you please:
- confirm if rFactor still crashes after emptying rf2py_plugins/?
- send me your rfactor2python.log.
- also, can you try rFactor2Python on a clean rFactor install?
You can also try to run another python application to see if python is correctly installed (python comes with IDLE IDE. To access it you can right click any .py file and chose Edit).
Cheers
hi,
i use 32bit version on 32bit windows 7.
rfactor is working without phyton plugins.
also there is no problem with serial plugin and log plugin.
the plugin can write the telemetry datas to txt file.
but if i try to use the sql plugin rfactor is not starting
can you tell the installing process of sql plugin so i can start over on a clean rfactor install.
(About log plugin: i want to know how to tracuate the txt file (because nearly it is over 100MB per a lap in a race) i want to have it once, then delete and new data comes. )
Thank you for your help
Hi.
That’s a strange behavior. Can you use MySQLdb at all? Try running a script that uses it.
If you want to truncate the file, look here: http://docs.python.org/library/functions.html#open
You want to open() it with ‘w’ at the beginning of a session and close it when the session ends.
The mysql plugin is much much more efficient.
Cheers
Hey!
Did you have any success with the code?
Cheers
Hi.
Can you please tell the exact python27.dll error? Also confirm that you have Python 2.7 32bit installed.
In order to use the mysql script you need to install MySQLdb python module. If you don’t want to compile it for Windows, there are [non official] binaries available (example: http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python).
Cheers
hi, very good plugin.
i able to use it for txt logging. but couldn’t work with database
it gives phtyon27.dll error if i start with the sql plugin inserted.
i downloaded and installed the mysql but dont know how to insert correct tables to where in your plugin.