Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. PyQt and Pylupdate5
Forum Updated to NodeBB v4.3 + New Features

PyQt and Pylupdate5

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
5 Posts 2 Posters 1.5k Views 1 Watching
  • 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.
  • R Offline
    R Offline
    rigla
    wrote on last edited by
    #1

    Re: Translation using PyQt and Pylupdate5

    Hello.
    I am trying to create a translation file:

    pylupdate5.py3 untitled.ui -ts zh_FN.ts
    

    I get an error:

    Traceback (most recent call last):
      File "/usr/lib64/python3.7/runpy.py", line 193, in _run_module_as_main
        "__main__", mod_spec)
      File "/usr/lib64/python3.7/runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "/usr/lib64/python3/site-packages/PyQt5/pylupdate_main.py", line 239, in <module>
        main()
      File "/usr/lib64/python3/site-packages/PyQt5/pylupdate_main.py", line 228, in main
        defaultContext, True)
    UnicodeEncodeError: 'latin-1' codec can't encode characters in position 12-21: ordinal not in range(256)
    

    For the test, I made an empty ui in Designer.
    Wrong encoding again.

    OS Linux
    python 3.7.4
    python3-module-PyQt5 5.11.3

    I am new to Python.
    Sorry if the question is stupid.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Can you show the content of your .ui file ?

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

      R 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Can you show the content of your .ui file ?

        R Offline
        R Offline
        rigla
        wrote on last edited by rigla
        #3

        @SGaist said in PyQt and Pylupdate5:

        Can you show the content of your .ui file ?

        A practically empty sample.

        <?xml version="1.0" encoding="UTF-8"?>
        <ui version="4.0">
         <class>MainWindow</class>
         <widget class="QMainWindow" name="MainWindow">
          <property name="geometry">
           <rect>
            <x>0</x>
            <y>0</y>
            <width>491</width>
            <height>323</height>
           </rect>
          </property>
          <property name="windowTitle">
           <string>MainWindow</string>
          </property>
          <widget class="QWidget" name="centralwidget">
           <layout class="QGridLayout" name="gridLayout">
            <item row="0" column="0" colspan="3">
             <widget class="QTextEdit" name="textEdit">
              <property name="html">
               <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
        &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
        p, li { white-space: pre-wrap; }
        &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
        &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Hi, I'm Zhenya.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
              </property>
             </widget>
            </item>
            <item row="1" column="0">
             <widget class="QPushButton" name="pushButton">
              <property name="text">
               <string>PushButton</string>
              </property>
             </widget>
            </item>
            <item row="1" column="1">
             <spacer name="horizontalSpacer">
              <property name="orientation">
               <enum>Qt::Horizontal</enum>
              </property>
              <property name="sizeHint" stdset="0">
               <size>
                <width>292</width>
                <height>20</height>
               </size>
              </property>
             </spacer>
            </item>
            <item row="1" column="2">
             <widget class="QPushButton" name="pushButton_2">
              <property name="text">
               <string>PushButton</string>
              </property>
             </widget>
            </item>
           </layout>
          </widget>
          <widget class="QStatusBar" name="statusbar"/>
         </widget>
         <resources/>
         <connections/>
        </ui>
        
        1 Reply Last reply
        0
        • R Offline
          R Offline
          rigla
          wrote on last edited by
          #4

          Answer.
          The path must not contain non-ascii characters.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Do you mean the path to the file ?

            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

            • Login

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