PoE-TradeMacro / POE-TradeMacro

Price checking script for Path of Exile.
https://poe-trademacro.github.io/
GNU General Public License v3.0
938 stars 189 forks source link

Error data (json) help #254

Closed UlfMitHand closed 7 years ago

UlfMitHand commented 7 years ago

Every time i start it up i get this error. help plz

unbenannt

tbarusseau commented 7 years ago

Same here, with 2.0.1

tgavankar commented 7 years ago

+1, here too for 2.0.0 and 2.0.1.

If it helps, I do NOT have AHK installed and I'm using the Fallback.exe. This worked in older versions (1.7.x and below)

copy0660 commented 7 years ago

I fixed my JSON error pretty easily. The problem comes from the jsonData.ahk file that fails to download a specific info from the pathofexile api(not much of a programmer, but that's how i think it works). I did it manually and i managed to launch the program. Here it is how i did it:

  1. Open http://api.pathofexile.com/leagues?type=main and select all the text.
  2. Ctrl+c (Copy it)
  3. Go to your PoE Trade Macro folder, where the main exe (Fallback.exe) is. For example: D:\Downloads\Programs\POE-TradeMacro-2.0.1
  4. Create a new folder named "temp". Make sure it's named exactly like this!
  5. Go into the "temp" folder and create a new text document.
  6. Open the document and paste the text that you copied from the link in the first step.
  7. Save the file with the name "currentLeagues" and also change the file extension from ".txt" to ".json"
  8. Run the Fallback.exe and it should be all fine.
Eruyome commented 7 years ago
  1. Don't run the Fallback exe unless you really have to. Use Run_TradeMacro.ahk.
  2. Running that exe skips deleting the temp folder on script start (I believe) so that solution could actually work.
  3. This download uses UrlDownloadToFile which should only fail when Internet Explorer is not installed or some proxies are blocking it. So it more or less shouldn't fail. I can try to implement a more robust solution.

Please use the script normally and check for me if the file currentLeagues exists in temp folder and tell me it's contents.

ndox138 commented 7 years ago

any fix for that???? yesterday i made the copy0660 advice and it works, but now after 2.02 this error back to ocours. i try to delete and intall again and now im getting this error even with the copy0660 advice :(

Eruyome commented 7 years ago

Unless you want to price check relic items use 2.0.1 then. Will have to see why is causing this. Are you all on Win10?

ndox138 commented 7 years ago

yep, win 10 64b. how i can get the 2.01 version?

Eruyome commented 7 years ago

github sucks and doesn't list it on the release page so https://github.com/POE-TradeMacro/POE-TradeMacro/releases/tag/2.0.1.

Btw, try not saving the folder somewhere in you windows user folder.

ndox138 commented 7 years ago

nice, i was using "documents" place to save the files, now i just put on C: and its working perfectly even without make the txt thing. thank you!

Songworks commented 7 years ago

Thanks. I had the same issue since 2.0.0, also on Windows 10 64bit. Moving the entire directory from Documents to Program Files "solved" it. :)

Eruyome commented 7 years ago

Could you guys run it again from documents folder after editing resources\ahk\jsonData.ahk and adding at line 47

msgbox % FileExist(A_ScriptDir "\temp\currentLeagues.json")

This should return the return value of FileExist(A_ScriptDir "\temp\currentLeagues.json")

This function returns the attribute string (a subset of "RASHNDOCT") of the first matching file or folder:

R = READONLY A = ARCHIVE S = SYSTEM H = HIDDEN N = NORMAL D = DIRECTORY O = OFFLINE C = COMPRESSED T = TEMPORARY

If the file has no attributes (rare), "X" is returned. If no file is found, an empty string is returned.

EDIT: Don't run the .exe file when testing this.

ndox138 commented 7 years ago

Im at work atm, ill be back home in +- 9 hours and i can try it

2017-03-06 9:28 GMT-03:00 Eruyome notifications@github.com:

Could you guys run it again from documents folder after editing resources\ahk\jsonData.ahk and adding at line 47

msgbox % test

This should return the return value of FileExist(A_ScriptDir "\temp\currentLeagues.json")

This function returns the attribute string (a subset of "RASHNDOCT") of the first matching file or folder:

R = READONLY A = ARCHIVE S = SYSTEM H = HIDDEN N = NORMAL D = DIRECTORY O = OFFLINE C = COMPRESSED T = TEMPORARY

If the file has no attributes (rare), "X" is returned. If no file is found, an empty string is returned.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PoE-TradeMacro/POE-TradeMacro/issues/254#issuecomment-284383193, or mute the thread https://github.com/notifications/unsubscribe-auth/AY_KUBr_0ntXeTnpy-xX1p4OYDUVQn1Qks5ri_wAgaJpZM4MS24V .

Eruyome commented 7 years ago

So far I noticed a few things:

  1. Some people have this json parse error when the downloaded file is in their user folder (when the macro folder is there)
  2. At least someone has an #include error for the VersionTrade.txt, also from inside the user folder.
  3. Someone has the problem that the AdditionalMacros file inside the user folder is not working when included in the script, but runs as separate ahk script.
  4. All reports so far seem to be from Win10.

This could be some issue with file attributes/permissions etc

Songworks commented 7 years ago

Tried as asked the change to resources\ahk\jsonData.ahk on a fresh 2.0.2 in directory C:\Users\Stefan\Documents\PoE-TradeMacro, running with either Run_TradeMacro.ahk or Run_TradeMacro_no_Admin_Elevation.ahk.

I got an empty string in the message box. When an installation is put under C:\Program Files (x86)\POE-TradeMacro, it outputs an A.

One thing I noticed when it is in the under the user directory: It appears the \temp directory gets deleted before it gets to the point of reading out the league data. When running Run_TradeMacro.ahk the \temp folder is created before I'm asked for admin privileges but gets deleted after I give them. Same probably happens with Run_TradeMacro_no_Admin_Elevation.ahk but Windows Explorer can't keep up with how fast it goes down and never even displays the temp folder at all. While with an installation under C:\Program Files (x86), the temp folder sticks around.

UlfMitHand commented 7 years ago

Uhm, i always started the fallback.exe

niw im starting the trademacro.ahk and its fine

tgavankar commented 7 years ago
Eruyome commented 7 years ago

@Songworks I've changed the head of the Run_TradeMacro.ahk file to this (you'll have to edit it) :

FileRemoveDir, %A_ScriptDir%\temp, 1
FileCreateDir, %A_ScriptDir%\temp

StringTrimLeft, pathNoDrive, A_ScriptDir, 3
userFolder  := "Users\" A_UserName "\"
isInUserFolder := InStr(pathNoDrive, userFolder)

While !FileExist(A_ScriptDir "\temp") {
    Sleep, 100
    FileCreateDir, %A_ScriptDir%\temp
    If (ErrorLevel or !FileExist(A_ScriptDir "\temp")) {        
                msg := "Directory " A_ScriptDir "\temp could not be created.`n`n"
        msg .= isInUserFolder ? "It seems you're running the script from inside your windows user folder. Windows asking you for admin privileges or simply not having them can interfere with the script in this case.`n`n" : ""
        msg .= "You can try again a few times, confirm admin privileges if asked or try running this file as administrator (right-click to open context menu).`n`n"
        msg .= "You can also move the script location to somewhere else on your pc, for example " A_ProgramFiles ". This should solve all issues and is considered the best solution."

        MsgBox, 5, PoE-TradeMacro, % msg
        IfMsgBox, Cancel
        {
            SplashTextOn, , 20, PoE-TradeMacro, Exiting script...
            Sleep, 2000
            SplashTextOff
            ExitApp
        }
    }
}

#Include, %A_ScriptDir%\resources\VersionTrade.txt

Could you check if those checks trigger when you start from inside the user folder and if it helps to retry?

EDIT: Maybe I should move this to the merged scripts again since the merger scripts are never run with admin elevation by default (that's probably causing a few issues). Maybe right-clicking Run_TradeMacro.ahk and run as administrator already solves all issues.

Songworks commented 7 years ago

No. On clean install, I get no additional messages beyond the issues error. :( Right-click and run as administrator has same result.

edit: I did a quick search through all ahk files for lines where the temp directory gets deleted. I found one in \lib\PoEScripts_HandleUserSettings.ahk line 81. If I comment the line out it runs through without error?

edit2: Works ingame as expected too.

Eruyome commented 7 years ago

Is that a reliable fix? This is not the temp folder in the script directory though, it's one in the user settings folder.

EDIT: This is only used to temporarily save the ini files/additional macros.txt while checking if they need to be copied over.

https://github.com/PoE-TradeMacro/POE-TradeMacro/archive/devEru.zip

You can just try my latest changes if you want. I implemented this check as function now, no idea if it will help but at least it seems to be solid and not causing additional issues.... https://raw.githubusercontent.com/PoE-TradeMacro/POE-TradeMacro/devEru/lib/PoEScripts_CreateTempFolder.ahk

Songworks commented 7 years ago

Yes! I made a clean installation into another directory \Documents\trademacro and it works. I guess the problem happens when both the scripts and the user settings are in the same directory \Documents\PoE-TradeMacro and subsequently use the same path for temp. Which in turn is deleted by the user settings scripts before the league info attempts to write into it.

Eruyome commented 7 years ago

Ohhhh... man I didn't even notice that you (and maybe some more people) are using the same directory for both.... Of course this shouldn't be the case.

Have to implement something to prevent this.

armed109106 commented 6 years ago

Hello , how to fix , not understun , im delete all files from my doc and from C - but after reinstall still not wroked : will new fixed version ? dont know how to fix

aRTy42 commented 6 years ago

@armed109106 What exactly is your error?