Resources text file unable to be opened in Windows, but works fine in Linux
-
Hello everyone, I have a strange issue. I am in the advanced stages of a project and have run into a showstopping problem. I am using PySide 6.9.2.
I have some somewhat large JSON files (around 150k) that I want to include with my program and read from the resources. I have successfully added the files to the resources and the program works just fine under Linux (Ubuntu 24.04)--the resource files can be loaded, the program runs just fine.
In Windows, however, the resources cannot be loaded. I get a generic "Input/Output" error.
This is the relevant code in question:
file = QFile(":/json/resources/json/stars_magnitudes.json") if not file.open(QFile.ReadOnly | QFile.Text): print(file.errorString()) return lines = [] textStream = QTextStream(file) while not textStream.atEnd(): lines.append(textStream.readLine()) data = "\n".join(lines) starsByMagnitude = json.loads(data)I am stumped why I am getting this error, and searching through the forums didn't give me any relevant results.
In case this might help solve things: I develop entirely within a Linux virtual machine and commit to a gitlab repository. On Windows for testing I simply pull from that repository into a virtual environment within Anaconda and run the code from the command-line. I don't compile the resources file on Windows but compile it on Linux, push it to the repository, and then use that same resources file on Windows. To date that hasn't caused any problems with any other resource file in my project (dozens of icons, other kinds of text files, etc).
Are there any suggestions of what could be going wrong here?
Thanks in advance.
-
As a further update, I've found that the issue only arises with large-ish JSON text files (over 100k) in the resources; my smaller JSON file, of only around 20k, works just fine on Windows.
Is there a maximum size for text files added to the resources on Windows?