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
Related
I am getting the following error when I run my code
Traceback (most recent call last):
File "ros_colour_node.py", line 26, in <module>
from detectron2.engine import DefaultPredictor
File "/home/nvidia/catkin_ws/src/ROS-label-node/detectron2/__init__.py", line 3, in <module>
from .utils.env import setup_environment
File "/home/nvidia/catkin_ws/src/ROS-label-node/detectron2/utils/env.py", line 3, in <module>
from importlib import util
ImportError: cannot import name util
I am using python2.7 to run my code on ROS melodic on jetson xavier NX with ubuntu 18.04.
I have installed the importlib library directly but it cant seem to find the util module.
I am trying to run instance segmentation using ROS on JEtson. I have tried to run the code from the following repo Segmentation
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'
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
I want to run my python program from command line but it gives me below error
ImportError: No module named 'main'
My folder structure is as below
Project
|-----main
|-----__init__.py
|-----S3Operations.py
|-----BusinessOperations.py
My init.py code is as below
import sys
from S3Operations import Models
sys.path.append("D:/code/Project/main")
if __name__ == '__main__':
s3=Models()
s3.test()
And my S3Operations.py code is
import os.path
from main import BusinessService
class ModelsMlS3(object):
def test(self):
print("Testing success")
When I run the program using command line i get the below error
$ python __init__.py
Traceback (most recent call last):
File "__init__.py", line 2, in <module>
from S3Operations import ModelsMlS3
File "D:\code\Project\main\S3Operations.py", line 11, in <module>
from main import BusinessService
ImportError: No module named 'main'
Can any one please suggest a solution for the same.
You just need to do:
import BusinessService # instead of `from main import BusinessService`
as in your project, there is no __init__.py file present in Project directory (which holds main.py).
For importing it like:
from main import BusinessService
you need to create __init__.py in the folder in order to make it as module.
I have installed tornado and following works fine, I am able to run hello,world app
python -c "import tornado"
but following results in error
python -c ""from tornado.netutil import TCPServer"
Import error
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: cannot import name TCPServer
full code : I am trying to run this https://gist.github.com/phuslu/1231481
You made the wrong imports from the wrong package, try the following:
import sys, os, re
import logging
from tornado.ioloop import IOLoop
from tornado.iostream import IOStream
from tornado.tcpserver import TCPServer
as your imports. I've tried and tested it.