-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSV datasource not converted from 3.16 to 3.22 correctly - projects not usable anymore #48587
Comments
may be this is connected with #48422 (wich is closed, but not solved AFAIK) |
@mlechner can you please attach the failing project and data that I can use for debugging? |
@elpaso as it is not my project, but from colleagues, and the data is sensible, i can not provide you with the failing project or data. I can try to create a simple project with example data that is appropriate for repoducing the bug. In the meantime I tried some thing with python, pointing out that a May be this hints helps until I can create a sample project |
Maybe you can send the project with the CSV redacted (just leave a couple of rows with fake data in it), data are probably not relevant to the bug, I think it's in the datasource URI encoding. |
see attached a minified example project (incl. *.qgs and data as *.zip) for reproducing the bug. just open in QGIS >= 3.22.5 (may be 3.22.x) |
Thanks for sharing, I have no problems to open the sample file with master or 3.24.2. Closing because I cannot reproduce the issue, it may be already fixed. |
I can NOT reproduce the bug on 3.22.7 LTR on Linux/Ubuntu anymore (don't know about 3.22.6). I will check 3.22.7 LTR on M$ Windoof. |
It seems to me my similar problem/bug opening delimited text files was gone after moving the data files to a local drive like |
@ukulle : can you verify that the only change made was moving the project from a network drive to local? Our status of exploring at the moment is like following:
I will post more details tomorrow, as this is not fully clearified for me, yet. Everything seems to break with the delimiter in the project being interpreted as "\t", "/t" or "%5Ct" while it definitely is "delimiter=\t&" in the orginal *.qgs file. |
Sorry, it was worded a bit misleadingly (corrected above now). I left the project file on a network drive and moved the data files to a local drive. I have simple data (points) but they are constantly updated with a text editor. For the workaround ("local drive"), I had to import the data files that were previously moved to I have tested with different delimiters (see file names below). `
|
@ukulle, @elpaso there definitely seems to be a bug on QGIS with handling on tab-delimiters (\t) just on Windows! The only working example-projects are
In addition I can say that the hovertext on the defect layer in the layer tree prits "/t" being the delimiter even "\t" is in the *.qgs file! @elpaso - could you please reopen this issue, as it definitely is not fixed yet, but only seems to affect Windows-versions. |
It seems to me the issue does occur on Windows with any QGIS version >= 3.22.0, while it doesn't occur with QGIS versions <= 3.20.3 (it this case, the only non working project is example_changedslash2). |
Until this is fixed in QGIS core I created a small experimental Plugin to fix a projects layers. |
that is correct. I just tried out several alternative slash/encoding configurations in the example file, without being sure that all of these can occur in practice. But it definitely can be said, that the problem can be narrowed to wrong parsing on Windows of "delimiter=\t" in the datasource definition in the project file. Well, the source() string of the layer is "delimiter=/t" on Windows, even thereis a backslash used in the project file (opened with an editor). So I guess fixing the parsing of this specific substring should fix QGIS. But that is far from my knowledge of QGIS code. |
The QGIS Plugin repository does have an experimental Plugin trying to fix this problem. Just as a temporarily workaround until the problem itself is fixed. See https://plugins.qgis.org/plugins/bfs_delimitedtext_pathfixer |
i found that changing the datasource section in the file qgs Just dont care about delimiter, they work well both , 'file:' is the key ! |
or may be an other way to workaround... |
Came across a similar issue which looks like it's related to an umlaut in a header field of the CSV. Minimal test case in #49186. |
I think so, too. |
It seems the data files provided by @mlechner don't have any umlaut in the header fields names. |
Right, I meant it is similar in the way that it seems to be related to source URL encoding/decoding and Windows specific. |
@elpaso at at the QGIS Changelog for 3.26 you wrote that it "Works for me on 3.24 and master". As this Bug is OS-specific (Windows only), did it work for you on Win/3.24 Win/master? |
It seems the problem has still not been solved. When will this error finally be fixed? at the moment its not possible to use a qgis version >3.16. |
Hi ed76, I can not fox the problem in 3.16 core (as I am not deep in the core code), but did you try my experimental plugin #48587 (comment) as a dirty workaround? Anyhow, I hope the bug will be fixed from one of the core developers who know how to fix it. |
@mlechner , @ed76 I am happy to have another look at the issue (on windows using current QGIS master) but I am having problems to understand how to reproduce it: I downloaded the last sample files from #48587 (comment), I created a new project and added the data from The delimiter is correctly encoded ad |
@elpaso (@ed76) it does not happen when just working on a recent version. The problem occurs when you open a project that has been created with 3.16.x QGIS on Windows with a current version on Windows. Then the CSV-Layers in the project can not be found anymore if the delimiter is a tab. The problem has been detected when 3.22.x became LTR and a bunch of existing 3.16.x (former LTR) projects did and do not open without problems in the current LTR version. I am not effected personally, but colleagues of mine are (and other users as well, I guess - e.g. @ed76) and I think this is a problematic bug, as the normal QGIS update procedure within the LTR slot results in broken projects! |
@mlechner thank you for clarifying. So it is not related to the data being on a network folder? |
@elpaso (@ed76 @mlechner) - the reproduction of behavior seems to be complex. Maybe I have a special case here.
The difference found in the project files: In case the datasource is located on a local drive exactly this problem part does not occur. I hope this can be reproduced and am looking forward to the feedback. |
I think I have found the problem. |
when importing old projects, delimiter might be unencoded. Fix qgis#48587
when importing old projects, delimiter might be unencoded. Fix #48587
when importing old projects, delimiter might be unencoded. Fix #48587
when importing old projects, delimiter might be unencoded. Fix #48587
What is the bug or the crash?
In a project created with QGIS 3.16.x the datasource of a CSV layer is give like:
<datasource>./aef/2und3k - Kopie.aef?type=csv&delimiter=\t&skipLines=115&skipEmptyFields=Yes&maxFields=10000&detectTypes=yes&decimalPoint=,&xField=Center East&yField=Center North&crs=EPSG:32636&spatialIndex=no&subsetIndex=no&watchFile=no</datasource>
When openinng the project in QGIS 3.22.5 the datasource is not found, even it exists at the correct place.
Original source URI: t&skipLines=115&skipEmptyFields=Yes&maxFields=10000&detectTypes=yes&decimalPoint=,&xField=Center East&yField=Center North&crs=EPSG:32636&spatialIndex=no&subsetIndex=no&watchFile=nott&skipLines=115&skipEmptyFields=Yes&maxFields=10000&detectTypes=yes&decimalPoint=,&xField=Center East&yField=Center North&crs=EPSG:32636&spatialIndex=no&subsetIndex=no&watchFile=no&t&skipLines=115&skipEmptyFields=Yes&maxFields=10000&detectTypes=yes&decimalPoint=,&xField=Center East&yField=Center North&crs=EPSG:32636&spatialIndex=no&subsetIndex=no&watchFile=nost&skipLines=115&skipEmptyFields=Yes&maxFields=10000&detectTypes=yes&decimalPoint=,&xField=Center East&yField=Center North&crs=EPSG:32636&spatialIndex=no&subsetIndex=no&watchFile=nokt&skipLines=115&skipEmptyFields=Yes&maxFields=10000&detectTypes=yes&decimalPoint=,&xField=Center East&yField=Center North&crs=EPSG:32636&spatialIndex=no&subsetIndex=no&watchFile=noit&skipLines=115&skipEmptyFields=Yes&maxFields=10000&detectTypes=yes&decimalPoint=,&xField=Center East&yField=Center North&crs=EPSG:32636&spatialIndex=no&subsetIndex=no&watchFile=nopt&skipLines=115&skipEmptyFields=Yes&maxFields=10000&detectTypes=yes&decimalPoint=,&xField=Center East&yField=Center North&crs=EPSG:32636&spatialIndex=no&subsetIndex=no&watchFile=noLt&skipLines=115&skipEmptyFields=Yes&maxFields=10000&detectTypes=yes&decimalPoint=,&xField=Center East&yField=Center North&crs=EPSG:32636&spatialIndex=no&subsetIndex=no&watchFile=noit&skipLines=115&skipEmptyFields=Yes&maxFields=10000&detectTypes=yes&decimalPoint=,&xField=Center East&yField=Center North&crs=EPSG:32636&spatialIndex=no&subsetIndex=no&watchFile=nont&skipLines=115&skipEmptyFields=Yes&maxFields=10000&detectTypes=yes&decimalPoint=,&xField=Center East&yField=Center North&crs=EPSG:32636&spatialIndex=no&subsetIndex=no&watchFile=noet&skipLines=115&skipEmptyFields=Yes&maxFields=10000&detectTypes=yes&decimalPoint=,&xField=Center East&yField=Center North&crs=EPSG ...
If I add the CSV file into a fresh project on 3.22.5 the datasource is saved as:
<datasource>file:./aef/2und3k%20-%20Kopie.aef?encoding&type=csv&delimiter=%5Ct&skipLines=115&skipEmptyFields=Yes&maxFields=10000&detectTypes=yes&decimalPoint=,&xField=Center%20East&yField=Center%20North&crs=EPSG:32636&spatialIndex=no&subsetIndex=no&watchFile=no</datasource>
And works without problems.
Seems that there have been changes in datasource handling and 3.22.x does not convert the old datasource values correctly.
This results in QGIS projects that can not be used anymore and have to be created from scratch when upgrading to 3.22.x - I guess this is a critical bug
Steps to reproduce the issue
see Workflow described above
Versions
3.22.5
Supported QGIS version
New profile
Additional context
No response
The text was updated successfully, but these errors were encountered: