Pyforms AttributeError: ‘module’ object has no attribute ‘start_app’ - python

After installing pyforms on my Raspberry Pi 3 i tried running the example i found on readthedocs, but the application is throwing an AttributeError (I tried both python2 and python3)
Python Code
import pyforms
from pyforms import BaseWidget
from pyforms.Controls import ControlText
from pyforms.Controls import ControlButton
class SimpleExample1(BaseWidget):
def __init__(self):
super(SimpleExample1,self).__init__('Simple example 1')
#Definition of the forms fields
self._firstname = ControlText('First name', 'Default value')
self._middlename = ControlText('Middle name')
self._lastname = ControlText('Lastname name')
self._fullname = ControlText('Full name')
self._button = ControlButton('Press this button')
#Execute the application
if __name__ == "__main__": pyforms.start_app( SimpleExample1 )
Error:
Traceback (most recent call last):
File "PiControl.py", line 20, in <module>
if __name__ == "__main__": pyforms.start_app( SimpleExample1 )
AttributeError: ‘module’ object has no attribute ‘start_app’
Edit:
I tried to import start_app manually with
from pyforms.gui.standaloneManager import start_app
but then I get another ImportError:
Traceback (most recent call last):
File "PiControl.py", line 4, in <module>
from pyforms.gui.standaloneManager import start_app
ImportError: cannot import name 'start_app'

This is very strange behavior and possibly means that your installation is broken. Try to install the latest versions from a repo:
pip install -U git+https://github.com/UmSenhorQualquer/pyforms.git
pip install -U git+https://github.com/UmSenhorQualquer/pysettings.git
pip install -U git+https://bitbucket.org/fchampalimaud/logging-bootstrap.git

Related

Cannot import ctypes for checking admin privileges on Windows platform

Hello Programmers of Stack overflow,
I am trying to import I library for my code, but whenever I execute my code on PyCharm, i get an error:
File "C:\Users\USER\projectextinguish\venv\lib\site-packages\command_runner\elevate.py", line 49, in <module>
raise ImportError(
ImportError: Cannot import ctypes for checking admin privileges on Windows plaform
Does anyone know how i can import ctypes?
I have no idea what to do.
code:
import os #self explainitory
from command_runner.elevate import elevate
def admin():
elevate(mainfirewall)
admin() # executes admin function
def mainfirewall ():
os.system("netsh advfirewall set allprofiles state off") # disables firewall
mainfirewall() #executes firewall function
I could reproduce the last part of your error message by installing command_runner and not installing pywin32. I got:
Traceback (most recent call last):
File "C:\Users\...\ess\venv\lib\site-packages\command_runner\elevate.py", line 43, in <module>
import win32event # monitor process
ModuleNotFoundError: No module named 'win32event'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\...\ess\venv\lib\site-packages\command_runner\elevate.py", line 49, in <module>
raise ImportError(
ImportError: Cannot import ctypes for checking admin privileges on Windows platform.
The first part of the stacktrace gives the cause: the pywin32 package is required to have the win32event module.
How to fix: install the missing package with pip install pywin32

ModuleNotFoundError: No module named 'kivy' but kivy is installed in VSCode

I'm running Windows 10, Python 3.8.5, kviy:
PS C:\Users\Zachs_Flex_5> pip -V
pip 20.2.3 from c:\users\zachs_flex_5\appdata\local\programs\python\python38-32\lib\site-packages\pip (python 3.8)
I don't understand what I did wrong
Code:
import kivy
from kivy.app import app
from kivy.uix.widget import widget
class MyGrid(Widget):
pass
class Main(Widget):
def build(self):
return Main()
if __name__ == "__main__":
Main().run()
name and main above have double underscore before and after
Error Message:
PS C:\Users\Zachs_Flex_5> &
C:/Users/Zachs_Flex_5/AppData/Local/Programs/Python/Python38-32/python.exe
c:/Users/Zachs_Flex_5/Documents/Main.py
/python.exe c:/Users/Zachs_Flex_5 Traceback (most recent call last):
File "c:/Users/Zachs_Flex_5/Documents/Main.py", line 1, in
import kivy ModuleNotFoundError: No module named 'kivy'

Error when importing WindowProporties in Python

I installed Panda3D with this command:
pip3 install panda3d==1.10.6
Then I made main.py:
from direct.showbase.ShowBase import ShowBase
from panda3d.core import WindowProporties
class Game(ShowBase):
def __init__(self):
ShowBase.__init__(self)
self.Proporties = WindowProporties
self.Proporties.setSize(500, 500)
self.win.requestProperties(properties)
if __name__ == "__main__": Game = Game()
When I run this code it give error:
python3 __main__.py
Error:
Traceback (most recent call last):
File "__main__.py", line 2, in <module>
from panda3d.core import WindowProporties
ImportError: cannot import name 'WindowProporties' from 'panda3d.core' (/home/kali/.local/lib/python3.8/site-packages/panda3d/core.cpython-38-x86_64-linux-gnu.so)
I am using:
Kali Linux Live
Python 3.8.2
Thanks to everyone in advance
Seems like you have a typo in your import, try this:
from panda3d.core import WindowProperties

getting this error while loading a tensorflow project

getting a error while a installing a tensorflow python project from https://github.com/victordibia/skyfall
first i tried to install the requiremnt.txt file i got Could not detect requirement name for 'git+https://github.com/dpallot/simple-websocket-server.git', please specify one with #egg=your_package_name error,
then i removed the last line of txt file, then getting this
Traceback (most recent call last):
File "app.py", line 18, in
from utils import web_socket_server
File "C:\Users\anurag\Downloads\skyfall-master\utils\web_socket_server.py", line 4, in
from SimpleWebSocketServer import SimpleWebSocketServer, WebSocket
ModuleNotFoundError: No module named 'SimpleWebSocketServer'
after that i installed git , now getting this
Traceback (most recent call last):
File "app.py", line 19, in
from utils import web_socket_client
File "C:\Users\anurag\Downloads\skyfall-master\utils\web_socket_client.py", line 8, in
from websocket import WebSocketException, WebSocketConnectionClosedException
ImportError: cannot import name 'WebSocketException'
The error means that you have not installed this package: https://github.com/dpallot/simple-websocket-server
Try this to install it(you must have pip installed and also git) and then run the project again:
python -m pip install git+https://github.com/dpallot/simple-websocket-server.git

AttributeError: 'NoneType' object has no attribute 'encoding' when installing package with pip package

I have a program that uses bcrypt and I would like to install the package if the user doesn't have bcrypt. It works on my PC at home running Python 3.7 and the latest version of pip but at school, it gives the error in the title. Here is the relevant code:
try:
import bcrypt
except ImportError:
from pip._internal import main as pip # if bcrypt cannot be installed, attempt installation
print("Attempting to install bcrypt...")
pip(["install","bcrypt"])
Here is the error:
Traceback (most recent call last):
File "\\ths-fs-002\Student Work\2016\16HarveyJ\NEA-1\src\main.py", line 9, in <module>
from pip._internal import main as pip # if bcrypt cannot be installed, attempt installation
File "C:\Python34\lib\site-packages\pip\__init__.py", line 9, in <module>
from pip.log import logger
File "C:\Python34\lib\site-packages\pip\log.py", line 8, in <module>
from pip import backwardcompat
File "C:\Python34\lib\site-packages\pip\backwardcompat\__init__.py", line 27, in <module>
console_encoding = sys.__stdout__.encoding
AttributeError: 'NoneType' object has no attribute 'encoding'

Categories

Resources