It is currently April 19th, 2024, 3:46 pm

Problems with WebParser and local log file

Get help with creating, editing & fixing problems with skins
Kosidive
Posts: 5
Joined: August 4th, 2021, 2:43 am

Problems with WebParser and local log file

Post by Kosidive »

I am trying to use webparser to parse a local file however since it is a log file and being constantly written to, I am given an error. The error I'm getting is.

Code: Select all

[MeasureParent]: (Fetch error) The process cannot access the file because it is being used by another process.  (ErrorCode=32)
How might I go around this issue? I'll leave my skin. I know it is not an issue with my regex because I tested it with RainRegExp and it worked just fine.

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Metadata]
Name=WarframeLevel
Author=Kosidive
Information=Reads Level Data from Log File
Version=1.0
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[MeasureLevel]
Measure=WebParser
URL=file://C:\Users\kosi\AppData\Local\Warframe\EE.log
RegExp=(?siU)Generated layout in(.*)Found
UpdateRate=10
Debug=2

[MeterLevel]
Meter=String
MeasureName=MeasureLevel
FontSize=12
FontColor=255,255,255,255
AntiAlias=1
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Problems with WebParser and local log file

Post by death.crafter »

Kosidive wrote: August 4th, 2021, 2:58 am I am trying to use webparser to parse a local file however since it is a log file and being constantly written to, I am given an error. The error I'm getting is.

Code: Select all

[MeasureParent]: (Fetch error) The process cannot access the file because it is being used by another process.  (ErrorCode=32)
How might I go around this issue? I'll leave my skin. I know it is not an issue with my regex because I tested it with RainRegExp and it worked just fine.

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Metadata]
Name=WarframeLevel
Author=Kosidive
Information=Reads Level Data from Log File
Version=1.0
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[MeasureLevel]
Measure=WebParser
URL=file://C:\Users\kosi\AppData\Local\Warframe\EE.log
RegExp=(?siU)Generated layout in(.*)Found
UpdateRate=10
Debug=2

[MeterLevel]
Meter=String
MeasureName=MeasureLevel
FontSize=12
FontColor=255,255,255,255
AntiAlias=1
I don't think you can access files that are currently being used by another app. It's the way it is.
from the Realm of Death
User avatar
DanDaBear
Posts: 110
Joined: February 23rd, 2018, 3:12 am
Location: United States

Re: Problems with WebParser and local log file

Post by DanDaBear »

I suppose you could save the log file to a temporary text file first then parse the temp text file.
Never underestimate the power of stupid! :D
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Problems with WebParser and local log file

Post by jsmorley »

The process that is creating the log is opening it in "exclusive" write mode, so you just won't be able to access it.

Assuming you can't control the code that is creating the log file, the only thing that comes to mind is to have Rainmeter "kill" the process that is creating the log, make a copy of it or read it directly, then restart the process. This is going to make reading the log file in any kind of "real time" way impossible of course.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Problems with WebParser and local log file

Post by balala »

DanDaBear wrote: August 4th, 2021, 11:51 am I suppose you could save the log file to a temporary text file first then parse the temp text file.
How?
User avatar
Yincognito
Rainmeter Sage
Posts: 7125
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Problems with WebParser and local log file

Post by Yincognito »

balala wrote: August 4th, 2021, 7:26 pmHow?
If not for the "exclusive mode" jsmorley mentioned, quite easily:
- use either Debug=2, Debug2File, Download or DownloadFile in the WebParser parent, to save the file
- use a 2nd WebParser parent to read the saved file, by opening it locally, through URL=file://SomePath\SomeFile.txt
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Problems with WebParser and local log file

Post by jsmorley »

Yincognito wrote: August 5th, 2021, 5:07 pm If not for the "exclusive mode" jsmorley mentioned, quite easily:
- use either Debug=2, Debug2File, Download or DownloadFile in the WebParser parent, to save the file
- use a 2nd WebParser parent to read the saved file, by opening it locally, through URL=file://SomePath\SomeFile.txt
Right, but I doubt that a file that is locked from reading is going to allow WebParser to make a copy of it.
User avatar
Yincognito
Rainmeter Sage
Posts: 7125
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Problems with WebParser and local log file

Post by Yincognito »

jsmorley wrote: August 5th, 2021, 5:08 pm Right, but I doubt that a file that is locked from reading is going to allow WebParser to make a copy of it.
Indeed, it probably won't...
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Problems with WebParser and local log file

Post by jsmorley »

File opening modes are pretty much the same for all languages.

In C, it's:

Code: Select all

r - open a file in read mode.
w - opens or create a text file in write mode.
a - opens a file in append mode.
r+ - opens a file in both read and write mode.
a+ - opens a file in both read and write mode.
w+ - opens a file in both read and write mode.
No doubt this log is opened in w or a mode.
User avatar
Yincognito
Rainmeter Sage
Posts: 7125
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Problems with WebParser and local log file

Post by Yincognito »

jsmorley wrote: August 5th, 2021, 5:25 pm File opening modes are pretty much the same for all languages.

In C, it's:

Code: Select all

r - open a file in read mode.
w - opens or create a text file in write mode.
a - opens a file in append mode.
r+ - opens a file in both read and write mode.
a+ - opens a file in both read and write mode.
w+ - opens a file in both read and write mode.
No doubt this log is opened in w or a mode.
As far as I know, it's a bit of a bad practice to do such things in an exclusive mode, but then, that software probably has its reasons to do so...
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth