0

I'm running a Python Script ("run whether user is logged on or not") on Windows Server 2016 every hour.

The Python Script basically just calls an API and exports the results into the JSON file. The problem is, that sometimes JSON file contains weird characters in a few fields. For example, "7494690" would be displayed as "�Qޘ'".

If I'm logged into the server via RDP, then files are coming out fine 10 out of 10 times. If I'm logged out and tasks run automatically, then most often (not always!) I get weird characters - roughly 8-9 times out of 10.

I've changed the user, but the issue persists. Any ideas..?

Edit: There's a new symptom. I've added the same task on a task scheduler twice. On the first attempt, I'm getting a corrupted file. On the second attempt, the file turns out fine. Could it be that Windows somehow picks up the the wrong locale/encoding?

6
  • What program you use to open/check that json file? Commented Mar 19, 2024 at 14:14
  • Just checking it on Notepad. There's also C# script that later picks up the file. Commented Mar 19, 2024 at 17:09
  • Is the whole file corrupted or only part? You may be experiencing some form of this bug: stackoverflow.com/questions/55690349/… Commented Mar 20, 2024 at 14:01
  • Only part. It's a massive nested JSON file, but only a few fields are affected. Commented Mar 21, 2024 at 8:51
  • So, it's not a problem with displaying the content of a file but the file itself is corrupted? Are the same fields corrupted every time? Maybe the way of processing fields is affected by user locale? Commented Mar 21, 2024 at 11:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.