Why does import pygame_textinput doesn't work? - python

I have tried using import pygame_textinput to call the pygame_textinput module. It doesn't work though. I got it from here.
Which was provided by another Stack Overflow page to get information about the pygame_textinput module as such:
How to create a text input box with pygame?
Just in case, I have tried getting it from the net as it is stated to be a third-party module but to no avail. I wrote the code in python shell as such:
import pygame_textinput
And got error message as such:
Traceback (most recent call last):
File "<pyshell#15>", line 1, in module
import pygame_textinput
ImportError: No module named pygame_textinput
Help? (PS. The word module in the error message second line is actually covered in < >. I deleted it as couldn't show.

Did you install it ? https://pypi.org/project/textinput/
pip install pygame_textinput
guide how to install pip: https://pip.pypa.io/en/stable/installing/

Related

ModuleNotFound error even pip is already used

I am a new at Python and I have a roblem with installing one framework.
https://github.com/zalando/connexion
I have already used the command in the terminal 'pip install connexion'
But still when I try to start a programm I get such error:
PS C:\Users\fele\OneDrive\Desktop\Python\Uebergabe\pYTHON_BACKEND_2020_03_12> & "C:/Program Files (x86)/Python37-32/python.exe" "c:/Users/fele/OneDrive/Desktop/Python/Uebergabe/pYTHON_BACKEND_2020_03_12/test_local/test_local_application_hook.py"
Traceback (most recent call last):
File "c:/Users/fele/OneDrive/Desktop/Python/Uebergabe/pYTHON_BACKEND_2020_03_12/test_local/test_local_application_hook.py", line 9, in <module>
from cwsm import connexion_manager
ModuleNotFoundError: No module named 'cwsm'
Cannot anybody give me a suggestion why is it happening?
Thanks in advance
The github page shows:
import connexion
So your import is wrong, try using connexion.
Source:
https://github.com/zalando/connexion#running-it

Python sound modules not working (Circular Import)

After installation of playsound and simpleaudio modules to try simple commands in order to play some audio files I always get the following message.
playsound: ImportError: cannot import name 'playsound' from partially initialized module 'playsound' (most likely due to a circular import) (/Users/joaosoares/Documents/PySound/playsound.py)
simpleaudio:AttributeError: partially initialized module 'simpleaudio' has no attribute 'WaveObject' (most likely due to a circular import)
I am currently using python 3.8.1, I've tried to create a new environment using pipenv and the problem persists. I got it to work the very first time I installed playsound. The problem might came after I had to install AppKit.NSSound as needed to run simplesound. My problem may be obvious and I apologise in advance if my issue isn't clarified I started to use python very recently.
I am following this tutorial
The only way i can reproduce your error is if i create a file called playsound.py
from playsound import playsound
playsound('myfile.wav')
ERROR
Traceback (most recent call last):
File "C:/Users/Chris/PycharmProjects/stackoverflow/stackoverflow.py", line 1, in <module>
from playsound import playsound
File "C:\Users\Chris\PycharmProjects\stackoverflow\playsound.py", line 1, in <module>
from playsound import playsound
ImportError: cannot import name 'playsound' from partially initialized module 'playsound' (most likely due to a circular import) (C:\Users\Chris\PycharmProjects\stackoverflow\playsound.py)
In your question your error specifically says your file is called playsound.py
/Users/joaosoares/Documents/PySound/playsound.py
rename this to something else otherwise it will try to import its self
There is Error in playsound Module So I has solved it for beginners
Hope so it's useful for you
Write This Command in Terminal that is provided in the image
https://i.stack.imgur.com/j6zcN.png
And Then Again Run the Python File and the Error is Solved
Now you can play sound using playsound module
https://i.stack.imgur.com/VQiNN.png
Note : Use double \ in path if you are a windows user else use \ in Mac and also enter Correct Path of song
just uninstall the current version by typing:
pip uninstall playsound
then install the older version by typing:
pip install playsound==1.2.2
just remove that playsound (use another name) and you are done

What is meant by `import coding`?

I am working with elffile python module/library. There is one line of code that is giving the following error
Traceback (most recent call last):
File "elffile.py", line 36, in <module>
import coding
ImportError: No module named coding
I could not find any python file or class named coding. Also, I didn't find anything on the internet regarding import coding.
Import is when you import modules to use in your coding.
If it cant find the module you probably have to install it. The easiest way to do this is to use pip.
Write: pip install coding (or pip3) and it will install the module.

Python third party Module global import

i'm currently into learning a bit of python and i want to import the paperclip third party module into my python file.
Yes, i already installed the pyperclip module with
pip install pyperclip.
if i create a file on my desktop, i get an error which says
Traceback (most recent call last):
File "test.py", line 1, in <module>
import pyperclip
ImportError: No module named pyperclip
However if i put the test.py in my python folder, it runs.
The question now is, is there a way to make all my installed modules available on a global scope ? I just want to have my file e.g. on my Desktop and run it without having import issues.
Thank you.
Greetings
Edit: I'm working on a Mac, maybe this leads to the problem
Found the problem.
The pip installautomatically used pip3.5 install
whereas python test.pydidn't use python3.5 test.py
Thank you #Bakurìu
Is there a way i can define python3.5as python?
You can do this :
pip3.5 install paperclip
pyperclip is install but not paperclip

Facebook-sdk python module has no attribute GraphAPI

After installing the facebook-sdk module here, and looking at other solutions here and elsewhere, I keep getting this error:
Traceback (most recent call last):
File "facebook.py", line 1, in <module>
import facebook
File "/home/facebook/facebook.py", line 3, in <module>
graph = facebook.GraphAPI(access_token='ACCESS TOKEN HERE')
AttributeError: 'module' object has no attribute 'GraphAPI'
For this very simple python code to authenticate...
import facebook
graph = facebook.GraphAPI(access_token='ACCESS TOKEN HERE')
print 'Workinnnn'
It says my module is installed and up to date, and I have installed both within (as suggested) a virtualenv and outside, and still get the error. I also definitely HAVE the module in usr/local/lib/python etc. dist packages... and it contains the class GraphAPI
Has anyone got a suggestion either:
1) What might be going wrong?
2) What to try to fix it? UNinstall something?
3) If there is another way other than pip to install the module... I don't normally use pip (but definitely have it installed and installed facebook-sdk from it) so if there's another way then I'd like to try...
Cheers :/
Solution = don't name your script the same as your module.
I'm an idiot, sigh...

Categories

Resources