QCanDbcFileParse load error
-
QCanDbcFileParser.parseData()does indeed work! Thanks for pointing that out, I hadn't noticed that method. I'm not sure why the encoding would matter. The contents are ASCII, which should be decoded by UTF-8 with no problem.Nothing obvious strikes me from the source here, but I guess
QStringis not included in PySide, so I can't easily check.It does seem like there should be a better error there, but this solves my immediate problem, and hopefully helps anyone else that runs into it. For the record, I'm on Linux. Thanks again!
-
D dhagrow has marked this topic as solved on
-
QCanDbcFileParser.parseData()does indeed work! Thanks for pointing that out, I hadn't noticed that method. I'm not sure why the encoding would matter. The contents are ASCII, which should be decoded by UTF-8 with no problem.Nothing obvious strikes me from the source here, but I guess
QStringis not included in PySide, so I can't easily check.It does seem like there should be a better error there, but this solves my immediate problem, and hopefully helps anyone else that runs into it. For the record, I'm on Linux. Thanks again!
@dhagrow
Yes,parseData()will work, the question is whyparser.parse(dbc_file)does not seem to open the file from its name. Just try makingdbc_filebe the correct full path to the file (not just plain"dbc_file") and check whether that makes a difference? -
I get this error instead when I pass in a full path, or even when I use any slash, e.g.
./test.dbc.QCanDbcFileParser.parse: file to open is a directory -
I think I found the problem. I noticed that there's an overload for
QCanDbcFileParser.parsethat takes a QStringList. It turns out that it works if I pass in['test.dbc']! I then tried['t']and['.']and get the same errors I was getting above. It seems PySide is wrapping the overloaded method. -
I think I found the problem. I noticed that there's an overload for
QCanDbcFileParser.parsethat takes a QStringList. It turns out that it works if I pass in['test.dbc']! I then tried['t']and['.']and get the same errors I was getting above. It seems PySide is wrapping the overloaded method.@dhagrow
But I thought you started from passing a sting, like"dbc_file". That should match parse(fileName) wherefileName – str. I don't know exactly what you tried? Where did you getdbc_filevaribale value from? Be careful of you prompted the user for it with QFileDialog.getOpenFileName(), that returns a list, not just the filename.I don't know whether you are now saying you are sorted or not.
-
Yes, I am sorted. The
QCanDbcFileParser.parseDataoption was all I needed, but I see that I can also useQCanDbcFileParser.parseif I pass in the file name in a list."dbc_file"came from a command-line argument, so effectively I was making the call like:parser.parse("test.dbc"). That appears to treat the string like a list, so withtest.dbcit would try to opent, and with./test.dbcit would try., both of which align with the errors I was seeing. I now see that I can make the call like:parser.parse(["test.dbc"]), which works.Basically, what I am saying is that PySide is not calling
QCanDbcFileParser::parse(QString). It is actually callingQCanDbcFileParser::parse(QStringList). -
Yes, I am sorted. The
QCanDbcFileParser.parseDataoption was all I needed, but I see that I can also useQCanDbcFileParser.parseif I pass in the file name in a list."dbc_file"came from a command-line argument, so effectively I was making the call like:parser.parse("test.dbc"). That appears to treat the string like a list, so withtest.dbcit would try to opent, and with./test.dbcit would try., both of which align with the errors I was seeing. I now see that I can make the call like:parser.parse(["test.dbc"]), which works.Basically, what I am saying is that PySide is not calling
QCanDbcFileParser::parse(QString). It is actually callingQCanDbcFileParser::parse(QStringList). -
I agree with @JonB. A Python string shares some interfaces with the list class however it should not trigger that issue. Something is wrong with the binding. You should open a ticket on the bug report system.
-
Issue created: https://bugreports.qt.io/browse/PYSIDE-3017