python subprocess no corre thunar

Forum Forums General Other Languages Spanish python subprocess no corre thunar

Tagged: 

  • This topic has 3 replies, 3 voices, and was last updated Aug 26-4:41 pm by Dave.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #40766
    Member
    mtoledo76999

      Hola

      Gracias por ver esto.

      Estas son unas salidas en ROXTerm
      `
      $ thunar
      ThunarThumbnailer: Failed to retrieve supported types: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.thumbnails.Thumbnailer1 was not provided by any .service files
      marco@fractal09:~
      $ ls -l
      total 72
      drwxr-xr-x 2 marco marco 4096 ago 25 03:47 compartida
      drwxr-xr-x 3 marco marco 4096 ago 25 22:28 Descargas
      drwxr-xr-x 2 marco marco 4096 ago 24 14:18 Documentos
      -rw-r–r– 1 marco marco 28399 ago 25 22:28 eelectroma.py
      drwxr-xr-x 2 marco marco 4096 ago 24 14:19 Escritorio
      drwxr-xr-x 3 marco marco 4096 ago 24 17:07 Imágenes
      drwxr-xr-x 16 marco marco 4096 ago 24 15:49 jd2
      -rw-r–r– 1 marco marco 1339 ago 25 03:44 montar_carpeta_windows_wn_linux.txt
      drwxr-xr-x 2 marco marco 4096 ago 24 14:18 Música
      -rwxrwxrwx 1 marco marco 1573 ago 25 23:23 panel.py
      drwxr-xr-x 3 marco marco 4096 ago 25 20:35 ramos
      drwxr-xr-x 3 marco marco 4096 ago 24 15:48 Vídeos

      cuando estaba en debian y ubuntu hacia

      subprocess.call(“ls”,”-l”) y resulataba

      Hice

      $ python
      Python 2.7.16 (default, Oct 10 2019, 22:02:15)
      [GCC 8.3.0] on linux2
      Type “help”, “copyright”, “credits” or “license” for more information.
      >>> import subprocess
      >>> subprocess.call(“ls”,”-l”)
      Traceback (most recent call last):
      File “<stdin>”, line 1, in <module>
      File “/usr/lib/python2.7/subprocess.py”, line 172, in call
      return Popen(*popenargs, **kwargs).wait()
      File “/usr/lib/python2.7/subprocess.py”, line 343, in __init__
      raise TypeError(“bufsize must be an integer”)
      TypeError: bufsize must be an integer
      >>> subprocess.call(“ls”)
      compartida Descargas Documentos eelectroma.py Escritorio Imágenes jd2 montar_carpeta_windows_wn_linux.txt Música panel.py ramos Vídeos
      0
      >>>
      [1]+ Detenido python
      pero al usar

      ./panel.py
      qt5ct: using qt5ct plugin

      sale la linea en blanco

      este es el trozo de codigo

      #!/usr/bin/env python
      # -*- coding: utf-8 -*-
      #http://zetcode.com/gui/pyqt5/
      #https://codeloop.org/introduction-to-pyqt5-qlineargradient-color/

      import sys, subprocess
      from PyQt5.QtWidgets import QApplication, QWidget, QToolTip, QPushButton
      from PyQt5.QtGui import QIcon, QPainter, QColor, QFont, QBrush, QPen, QLinearGradient
      from PyQt5.QtCore import Qt

      class Panel(QWidget):
      def paintEvent(self, event):
      qp = QPainter()
      qp.begin(self)
      self.drawRectangles(qp)
      qp.end()

      def drawRectangles(self, qp):
      qp.setPen(QPen(Qt.black,6, Qt.SolidLine))
      grad1 = QLinearGradient(25, 100, 150, 175)

      grad1.setColorAt(0.0, Qt.darkGray)
      grad1.setColorAt(0.5, Qt.green)
      grad1.setColorAt(1.0, Qt.yellow)
      qp.setBrush(QBrush(grad1))

      #qp.setBrush(QColor(26, 34, 74))
      qp.drawRect(-1,-1, 51, 501)

      def __init__(self):
      super(Panel, self).__init__()

      self.initUI()

      def initUI(self):

      QToolTip.setFont(QFont(‘SansSerif’, 10))

      self.setToolTip(‘This is a <b>QWidget</b> widget’)

      btn = QPushButton(”, self)
      btn.setToolTip(‘This is a <b>QPushButton</b> widget’)
      btn.resize(btn.sizeHint())
      btn.setGeometry(10,10, 30,30)
      # btn.clicked.connect(self.fthunar)

      self.setGeometry(50, 100, 50, 500)
      self.setWindowTitle(”)
      #self.setWindowIcon(QIcon(‘web.png’))

      self.show()

      def fthunar(self):
      subprocess.call(“ls”)

      def main():

      app = QApplication(sys.argv)
      ex = Panel()
      sys.exit(app.exec_())

      if __name__ == ‘__main__’:
      main()

      Este es mi sistema

      System: Host: fractal09 Kernel: 4.9.212-antix.1-amd64-smp x86_64 bits: 64 compiler: gcc
      v: 8.3.0
      parameters: BOOT_IMAGE=/vmlinuz-4.9.212-antix.1-amd64-smp
      root=UUID=a3cfd23a-a884-4708-90af-0089272e6dfb ro quiet
      Desktop: IceWM 1.6.5 wm: JWM 2.3.7 dm: SLiM 1.3.6
      Distro: antiX-19.2_x64-full Hannie Schaft 27 March 2020
      base: Debian GNU/Linux 10 (buster)
      Machine: Type: Laptop System: HP product: HP Laptop 15-db0xxx v: Type1ProductConfigId
      serial: <filter> Chassis: type: 10 serial: <filter>
      Mobo: HP model: 84AC v: 85.27 serial: <filter> UEFI: Insyde v: F.28 date: 05/08/2020
      Battery: ID-1: BAT1 charge: 41.2 Wh condition: 41.2/41.0 Wh (100%) volts: 12.9/11.4
      model: Hewlett-Packard PABAS0241231 type: Li-ion serial: <filter> status: Full
      Memory: RAM: total: 3.81 GiB used: 2.13 GiB (55.8%)
      RAM Report: permissions: Unable to run dmidecode. Root privileges required.
      PCI Slots: Permissions: Unable to run dmidecode. Root privileges required.
      CPU: Topology: Dual Core model: AMD A6-9225 RADEON R4 5 COMPUTE CORES 2C+3G bits: 64
      type: MCP arch: Excavator family: 15 (21) model-id: 70 (112) stepping: N/A
      microcode: 6006705 L2 cache: 1024 KiB bogomips: 10381
      Speed: 1300 MHz min/max: 1300/2600 MHz boost: enabled Core speeds (MHz): 1: 1300
      2: 1300
      Flags: 3dnowprefetch abm acc_power aes aperfmperf apic arat avic avx avx2 bmi1 bmi2
      bpext clflush cmov cmp_legacy constant_tsc cpb cr8_legacy cx16 cx8 de decodeassists
      extapic extd_apicid f16c flushbyasid fma fma4 fpu fsgsbase fxsr fxsr_opt ht hw_pstate
      ibpb ibs lahf_lm lbrv lm lwp mca mce misalignsse mmx mmxext monitor movbe msr mtrr
      mwaitx nodeid_msr nonstop_tsc nopl npt nrip_save nx osvw overflow_recov pae pat
      pausefilter pclmulqdq pdpe1gb perfctr_core perfctr_nb pfthreshold pge pni popcnt pse
      pse36 ptsc rdtscp rep_good sep skinit smep ssbd sse sse2 sse4_1 sse4_2 sse4a ssse3 svm
      svm_lock syscall tbm tce tsc tsc_scale vmcb_clean vme vmmcall wdt xop xsave xsaveopt
      Vulnerabilities: Type: itlb_multihit status: Not affected
      Type: l1tf status: Not affected
      Type: mds status: Not affected
      Type: meltdown status: Not affected
      Type: spec_store_bypass
      mitigation: Speculative Store Bypass disabled via prctl and seccomp
      Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization
      Type: spectre_v2
      mitigation: Full AMD retpoline, IBPB: conditional, STIBP: disabled, RSB filling
      Type: tsx_async_abort status: Not affected
      Graphics: Device-1: AMD Stoney [Radeon R2/R3/R4/R5 Graphics] vendor: Hewlett-Packard
      driver: amdgpu v: kernel bus ID: 00:01.0 chip ID: 1002:98e4
      Display: x11 server: X.Org 1.20.4 driver: amdgpu,ati unloaded: fbdev,modesetting,vesa
      resolution: 1366×768~60Hz
      OpenGL: renderer: AMD STONEY (DRM 3.8.0 4.9.212-antix.1-amd64-smp LLVM 7.0.1)
      v: 4.5 Mesa 18.3.6 direct render: Yes
      Audio: Device-1: AMD vendor: Hewlett-Packard driver: snd_hda_intel v: kernel bus ID: 00:01.1
      chip ID: 1002:15b3
      Device-2: AMD Family 15h Audio vendor: Hewlett-Packard driver: snd_hda_intel v: kernel
      bus ID: 00:09.2 chip ID: 1022:157a
      Sound Server: ALSA v: k4.9.212-antix.1-amd64-smp

      #40768
      Member
      mtoledo76999
        Helpful
        Up
        0
        ::

        Sorry por las molestias, fue un descuido

        Esta es la solución

        def initUI(self):

        QToolTip.setFont(QFont(‘SansSerif’, 10))

        self.setToolTip(‘This is a <b>QWidget</b> widget’)

        self.btn = QPushButton(”, self)
        self.btn.setToolTip(‘This is a <b>QPushButton</b> widget’)
        self.btn.resize(self.btn.sizeHint())
        self.btn.setGeometry(10,10, 30,30)
        self.btn.clicked.connect(self.fthunar)

        self.setGeometry(50, 100, 50, 500)
        self.setWindowTitle(”)
        #self.setWindowIcon(QIcon(‘web.png’))

        self.show()

        def fthunar(self):
        self.process = QProcess()
        self.process.start(“/usr/bin/thunar”)

        #40791
        Member
        Xecure
          Helpful
          Up
          0
          ::

          I don’t know what the problem was but well done figuring it out.
          And thanks for giving the solution, in case someone else needs python + qt development tips for a similar case.

          antiX Live system enthusiast.
          General Live Boot Parameters for antiX.

          #40799
          Forum Admin
          Dave
            Helpful
            Up
            0
            ::

            I don’t know what the problem was but well done figuring it out.
            And thanks for giving the solution, in case someone else needs python + qt development tips for a similar case.

            Same; I am not certain what the original problem was. The interactive cli terminal output would have failed due to calling “-l” as a separate process from ls instead of an argument to ls. Not certain on the relationship to the script however. Unless it was expected to work when the button was pressed… but the button press call to the fthunar function is commented out. Good to see Qprocess works though

            Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown

          Viewing 4 posts - 1 through 4 (of 4 total)
          • You must be logged in to reply to this topic.