[REL] rFactor2 Log Analyzer ver. 2. With offline and league Championship Manager

Hi Nibo,
This may end up being a bit of a long post, sorry....I've been playing around with trying to get images to display in the results screen and running into a few anomalies, most of which I think may be rF2 doing rF2 things.
Ok first up part of the xml file looks like this;
r2la-xml.jpg


r2la options page;
r2la-carid-options.jpg

This results in every car having the same pic;
r2la-carid-results.jpg


r2la-inspection-carid.jpg


Selecting either Category or CarClass in options returns a database error
r2la-categoryANDCarClassrtype.jpg


From my testing this is what's happening;
In Options select Car Type => selects Car type from xml.............. This looks OK
In Options select Car ID => selects Car type from xml...................This doesn't look correct (to me)
In Options select Driver Name => selects Driver Name from xml...This looks OK
In Options select Category or Car Class => database error.............Don't know what's happening here.

I've also tried a couple of other mods and the same behaviour applies there.
On the latest version rF2 Log Analyzer ver. 2.2.004
 
Goanna, thanks for reporting. There was an error on Session Report page when selecting CarClass or Category as key words for images. I don't really know how it was unnoticed by me or somebody else for a year... Please write if you spot any other errors with new version 2.2.005.

About CarId key word for images. It will be CarType for most of the cars, this is by design. It is most of the time not unique for every car. But there is "Add car number to image filename" check box just for this purpose. It will add a car number before key word, in your case "016a_Restricted" will become "6_016a_Restricted" for car #6 and so on.

You can also change how CarId is formed on options page http://127.0.0.1:8000/options/cars But I do not recommend it. There is no good other combination of identifiers for this car mod, as far as I can see.

Updated to v2.2.005
  • Fixed an error when selecting images for report tables with CarClass or Category as key words.
 
Hi everyone, first of all let me thank you for creating such a useful tool!

I am currently having a bit of an issue trying to get xml files to run via ajax, I am trying to display R2LA data on our website and I want to get richer results when going through historical round information, I am aware of this code;
Code:
$.ajax({
   url: 'http://your-r2la-address:port/report/get_report_jsonp',
   type: 'GET',
   dataType: 'jsonp',
   crossDomain: true,
   data: {'file_name': '2020_06_27_08_16_10-54R1.xml'},
   success: function (data, textStatus, xhr) {
       console.log(data);
   },
   error: function (xhr, textStatus, errorThrown) {
       console.log(errorThrown);
   }
});
But I can't get this to work at all, so much so that I've tried it on someone else's R2LA site and I get exactly the same error. Am I doing something wrong?

PS: After a bit of digging through the error folder, this is what everyone's favourite LLM came up with:

What’s going wrong
Your report/get_report_jsonp action is building a Python dict that contains at least one gluon.html.DIV (a Web2py HTML object). Then it calls json.dumps(...) without a default=... converter. Python’s JSON encoder doesn’t know how to serialize a DIV, so you get:

TypeError: Object of type DIV is not JSON serializable

You can see in your trace it’s literally failing inside controllers.report.get_report_jsonp.py at the json.dumps(...) call, and Web2py even tries to render report/get_report_jsonp.html (an HTML view), which suggests the action falls back to a view path that injects a DIV into the dict it’s trying to dump.

Minimal, safe patch in the existing action
Edit applications/r2la/controllers/report.py (the source; Web2py will recompile), inside def get_report_jsonp() where you do the json.dumps. Change it to sanitize non-JSON objects:
Code:
import json

def _safe_default(o):
    # Convert Web2py HTML helpers (DIV, SPAN, etc.) to strings
    try:
        return o.xml()  # most web2py html objects have .xml()
    except Exception:
        return str(o)

# ... inside get_report_jsonp():
callback = request.vars.get('callback') or 'callback'
# whatever you currently build as `data`:
# data = {...}
payload = json.dumps(data, ensure_ascii=False, default=_safe_default)
return f'{callback}({payload});'
 
Last edited:
Yes, I did not notice I broke get_report_jsonp when I added new rendering method to position badges.

Updated to v.2.2.006
  • Fixed an error with get_report_jsonp and get_latest_json ajax requests.
Dunno if I'm doing something wrong here or not but results with no drivers are not being removed for me.
R2la-noRemoveEmpty.png

EDIT: contents of xml that's highlighted in the above pic.
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE rF [
<!ENTITY rFEnt "rFactor Entity">
]>
<rFactorXML version="1.0">
<RaceResults>
<Setting>Multiplayer</Setting>
<ServerName>Goanna&apos;s Place</ServerName>
<ClientFuelVisible>2</ClientFuelVisible>
<PlayerFile>Player</PlayerFile>
<DateTime>1760654602</DateTime>
<TimeString>2025/10/17 08:43:22</TimeString>
<Mod>25test</Mod>
<Season></Season>
<TrackVenue>Autodrome of Portugal</TrackVenue>
<TrackCourse>Portugal GP Layout</TrackCourse>
<TrackEvent>GP Layout</TrackEvent>
<TrackData>C:\rF2-Dedicated\Installed\Locations\Portugal_2009\2.28\Portugal_GP.mas</TrackData>
<TrackLength>4169.8</TrackLength>
<GameVersion>1.1134</GameVersion>
<Dedicated>1</Dedicated>
<ConnectionType upload="14000" download="34000">Custom</ConnectionType>
<RaceLaps>5</RaceLaps>
<RaceTime>0</RaceTime>
<MechFailRate>1</MechFailRate>
<DamageMult>50</DamageMult>
<FuelMult>1</FuelMult>
<TireMult>1</TireMult>
<VehiclesAllowed>|GT2_2009_C6R|GT2_2010_C6R|GT2_C6R</VehiclesAllowed>
<ParcFerme>3</ParcFerme>
<FixedSetups>0</FixedSetups>
<FreeSettings>11</FreeSettings>
<FixedUpgrades>0</FixedUpgrades>
<Practice1>
<DateTime>1760654602</DateTime>
<TimeString>2025/10/17 08:43:22</TimeString>
<Laps>2147483647</Laps>
<Minutes>60</Minutes>
<Stream>
</Stream>
<MostLapsCompleted>0</MostLapsCompleted>
</Practice1>
</RaceResults>
</rFactorXML>

2nd EDIT: Disregard, it somehow sorted itself out after i started a 2.2.005 instance to check something and then fired up 2.2.006 and all was good with the world.
Cheers
 
Last edited:
Back
Top