Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. ModuleNotFoundError: when importing from "__feature__"
Forum Updated to NodeBB v4.3 + New Features

ModuleNotFoundError: when importing from "__feature__"

Scheduled Pinned Locked Moved Unsolved Qt for Python
4 Posts 3 Posters 1.5k Views 2 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.
  • T Offline
    T Offline
    Tallhamer
    wrote on last edited by
    #1

    I have installed PySide6 into a clean python 3.8.x environment using

    pip install pyside6

    However when I try to import from the __features__ module I get the following Traceback

    Traceback (most recent call last):
    File "C:/Users/miket/Projects/PySide6_Training/custom_main_win.py", line 2, in <module>
    from __feature__ import snake_case, true_property
    ModuleNotFoundError: No module named '__feature__'

    Any thoughts on what might be causing this?

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

      Hi and welcome to devnet,

      Which OS are you running ?
      Can you provide a minimal runnable script that shows the issue ?

      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
      • T Offline
        T Offline
        Tallhamer
        wrote on last edited by
        #3

        Sure. I'm on Windows 10 writing code in PyCharm

        The following works

        import sys
        from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton
        
        class MainWindow(QMainWindow):
            def __init__(self):
                super(MainWindow, self).__init__()
                self.setWindowTitle("My App")
        
                # This is the old way using the set function
                button = QPushButton("Click Me")
                button.setEnabled(False)
        
                self.setCentralWidget(button)
        
        app = QApplication([])
        window = MainWindow()
        window.show()
        sys.exit(app.exec_())
        

        While this code throws the previously listed Traceback stating the ModuleNotFoundError

        import sys
        from __feature__ import snake_case, true_property
        from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton
        
        class MainWindow(QMainWindow):
            def __init__(self):
                super(MainWindow, self).__init__()
                self.setWindowTitle("My App")
        
                # This is using the functionality from __feature__
                button = QPushButton("Click Me")
                button.enabled = False
                
                self.setCentralWidget(button)
        
        app = QApplication([])
        window = MainWindow()
        window.show()
        sys.exit(app.exec_())
        
        eyllanescE 1 Reply Last reply
        0
        • T Tallhamer

          Sure. I'm on Windows 10 writing code in PyCharm

          The following works

          import sys
          from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton
          
          class MainWindow(QMainWindow):
              def __init__(self):
                  super(MainWindow, self).__init__()
                  self.setWindowTitle("My App")
          
                  # This is the old way using the set function
                  button = QPushButton("Click Me")
                  button.setEnabled(False)
          
                  self.setCentralWidget(button)
          
          app = QApplication([])
          window = MainWindow()
          window.show()
          sys.exit(app.exec_())
          

          While this code throws the previously listed Traceback stating the ModuleNotFoundError

          import sys
          from __feature__ import snake_case, true_property
          from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton
          
          class MainWindow(QMainWindow):
              def __init__(self):
                  super(MainWindow, self).__init__()
                  self.setWindowTitle("My App")
          
                  # This is using the functionality from __feature__
                  button = QPushButton("Click Me")
                  button.enabled = False
                  
                  self.setCentralWidget(button)
          
          app = QApplication([])
          window = MainWindow()
          window.show()
          sys.exit(app.exec_())
          
          eyllanescE Offline
          eyllanescE Offline
          eyllanesc
          wrote on last edited by eyllanesc
          #4

          @Tallhamer __feature__ must be imported after PySide6, also you must change setCentralWidget to set_central_widget:

          import sys
          
          from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton
          from __feature__ import snake_case, true_property
          
          
          class MainWindow(QMainWindow):
              def __init__(self):
                  super(MainWindow, self).__init__()
                  self.setWindowTitle("My App")
          
                  # This is using the functionality from __feature__
                  button = QPushButton("Click Me")
                  button.enabled = False
          
                  self.set_central_widget(button)
          
          
          app = QApplication([])
          window = MainWindow()
          window.show()
          sys.exit(app.exec_())
          

          If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

          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