Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. QCanDbcFileParse load error

QCanDbcFileParse load error

Scheduled Pinned Locked Moved Solved Language Bindings
19 Posts 4 Posters 826 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dhagrow
    wrote on 8 Feb 2025, 01:52 last edited by
    #10

    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 QString is 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!

    J 1 Reply Last reply 8 Feb 2025, 09:09
    0
    • D dhagrow has marked this topic as solved on 8 Feb 2025, 04:52
    • D dhagrow
      8 Feb 2025, 01:52

      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 QString is 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!

      J Offline
      J Offline
      JonB
      wrote on 8 Feb 2025, 09:09 last edited by
      #11

      @dhagrow
      Yes, parseData() will work, the question is why parser.parse(dbc_file) does not seem to open the file from its name. Just try making dbc_file be the correct full path to the file (not just plain "dbc_file") and check whether that makes a difference?

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dhagrow
        wrote on 10 Feb 2025, 13:27 last edited by dhagrow 2 Oct 2025, 13:27
        #12

        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
        
        J 1 Reply Last reply 10 Feb 2025, 13:43
        0
        • D dhagrow
          10 Feb 2025, 13:27

          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
          
          J Offline
          J Offline
          JonB
          wrote on 10 Feb 2025, 13:43 last edited by
          #13

          @dhagrow
          Well that's very odd if it's a file and is reported as an open directory failure.
          And also odd but maybe significant if the path alters message from "No such file or directory" to "file to open is a directory".

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dhagrow
            wrote on 10 Feb 2025, 15:29 last edited by
            #14

            I think I found the problem. I noticed that there's an overload for QCanDbcFileParser.parse that 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.

            J 1 Reply Last reply 10 Feb 2025, 15:49
            0
            • D dhagrow
              10 Feb 2025, 15:29

              I think I found the problem. I noticed that there's an overload for QCanDbcFileParser.parse that 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.

              J Offline
              J Offline
              JonB
              wrote on 10 Feb 2025, 15:49 last edited by
              #15

              @dhagrow
              But I thought you started from passing a sting, like "dbc_file". That should match parse(fileName) where fileName – str. I don't know exactly what you tried? Where did you get dbc_file varibale 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.

              1 Reply Last reply
              0
              • D Offline
                D Offline
                dhagrow
                wrote on 10 Feb 2025, 17:00 last edited by
                #16

                Yes, I am sorted. The QCanDbcFileParser.parseData option was all I needed, but I see that I can also use QCanDbcFileParser.parse if 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 with test.dbc it would try to open t, and with ./test.dbc it 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 calling QCanDbcFileParser::parse(QStringList).

                J 1 Reply Last reply 10 Feb 2025, 18:05
                0
                • D dhagrow
                  10 Feb 2025, 17:00

                  Yes, I am sorted. The QCanDbcFileParser.parseData option was all I needed, but I see that I can also use QCanDbcFileParser.parse if 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 with test.dbc it would try to open t, and with ./test.dbc it 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 calling QCanDbcFileParser::parse(QStringList).

                  J Offline
                  J Offline
                  JonB
                  wrote on 10 Feb 2025, 18:05 last edited by
                  #17

                  @dhagrow Fine for a workaround, but if what you say is true that would apparently be a bug in PySide.

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 10 Feb 2025, 19:51 last edited by
                    #18

                    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.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      dhagrow
                      wrote on 11 Feb 2025, 18:30 last edited by
                      #19

                      Issue created: https://bugreports.qt.io/browse/PYSIDE-3017

                      1 Reply Last reply
                      2

                      19/19

                      11 Feb 2025, 18:30

                      • Login

                      • Login or register to search.
                      19 out of 19
                      • First post
                        19/19
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved