I'm trying to copy this code for instagram video scraping for compilations but it's giving me these errors, what can I do to fix this? - python

enter image description hereenter image description here
Hi, im new to python, what could be the issue and what can be done to fix this? Help would be much appreceated.
File "C:\Users\Georgs\PycharmProjects\automated_youtube_channel\main.py", line 1, in <module>
from scrape_videos import scrapeVideos
File "C:\Users\Georgs\PycharmProjects\automated_youtube_channel\scrape_videos.py", line 2, in <module>
import dateutil.relativedelta
ModuleNotFoundError: No module named 'dateutil'

Install dateutil with pip:
pip install python-dateutil

Related

PyAutoGui screenshot function weird [duplicate]

I'm trying to use pyautogui's screenshot functions with Python 3.6.5 on OSX 10.11.
>>> import pyautogui
>>> image = pyautogui.screenshot()
I get:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyscreeze/__init__.py", line 331, in _screenshot_osx
im = Image.open(tmpFilename)
NameError: name 'Image' is not defined
My understanding is that pyscreeze is failing to get the name Image from Pillow for some reason. I tried to update the pyautogui (it was up to date), then reinstall the pyautogui, which carries all its dependencies including pyscreeze and Pillow along with it.
I found this question with the same issue, but the fix that worked there (reinstalling) isn't working for me.
do
pip install Pillow==0.1.13
since Image is module from PIL
pip3 uninstall pyautogui
pip3 uninstall Pillow
then reinstall the modules and restart you editor.

No module named 'PyPDF2' When Trying to Import

I am attempting to Import PyPDF2 in order to read a PDF file and parse through it. I am using a Raspberry Pi, and have installed PyPDF2 using the command pip install PyPDF2. However, when I try importing it, I am getting ModuleNotFoundError.
I think it may have installed it into the wrong location. When I do python -V it says I am using version 2.7.16. But the error states it's trying to look into the python3 folder?
I am attempting to import it using the line import PyPDF2
The error I'm getting is:
Traceback (most recent call last):
File "/home/pi/SqlDatabase.py", line 5, in <module>
import PyPDF2
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 305, in _custom_import
module = self._original_import(*args, **kw)
ModuleNotFoundError: No module named 'PyPDF2'
Any idea of how I can install PyPDF into the correct directory, or perhaps a different solution?
If you are starting the program with python3 (e.g. see if the first line of the file has #!/usr/bin/python3 or similar), you need to install the library with pip3.
It seems that you have not installed PyPDF2 module in your device.
Execute following code in your terminal:
pip install PyPDF2
or
pip3 install PyPDF2
I think this will solve your problem. If this does not solve your problem, then there may be problem in your directory of python.
I have also faced the same issue. Note that Python is a case-sensitive language.
While using the import command use PyPDF2 and not pyPDF2
To install:
pipenv install PyPDF2
To import:
import PyPDF2

ImportError: cannot import name 'InsecureRequestWarning' (PYTHON3 | RPI3 | gTTS)

I'm having trouble using gTTS (Google Text to Speech) on my raspberry Pi 3. I simply did
sudo pip3 install gTTS
to install it. But when I run my code I find this error :
File "interface.py", line 7, in <module>
from gtts import *
File "/usr/local/lib/python3.4/dist-packages/gtts/\__init__.py", line 2, in <module>
from .tts import gTTS
File "/usr/local/lib/python3.4/dist-packages/gtts/tts.py", line 4, in <module>
from requests.packages.urllib3.exceptions import InsecureRequestWarning
ImportError: cannot import name 'InsecureRequestWarning'
To try to solve the problem I did
sudo easy_install --upgrade pip
Then I have uninstalled and installed again gtts but the problem persists.
Thank you very much for your help ! :(
PS : I have installed python-vlc and mutagen to make working gTTS (as I did on a windows device)
Just update requests library
pip install -U requests
Try this way.`
import urllib3`
urllib3.disable_warnings()
Though it doesn't remove the entire warning message, still removes the Insecure Request Warning
Fixed it by running pip install requests==2.6.0
if you face issue with bringing request library to 2.6.0 first remove pyopenssl and then run pip install requests==2.6.0
I don't know if you still want to know but I can partially answer it.
import gtts
why this will work is because gtts automatically imports .tts and gTTS.
This is gtts.__init():
from .version import __version__
from .tts import gTTS
It's the only code in there.
You can go look yourself in the folder:
/usr/local/lib/python3.4/dist-packages/gtts
OR
/usr/local/lib/python2.7/dist-packages/gtts
I am also trying to figure out still, how to use it but otherwise no.

error importing pptx library python

i want to import pptx but i'm using this
import sys
sys.path.insert(0,'D:/apera/python27/python-pptx-0.5.6')
import pptx
but somehow it shows error like this
Traceback (most recent call last):
File "D:/apera/Workspace/Python scripting test 6/ppt.py", line 5, in <module>
import pptx
File "D:/apera/python27/python-pptx-0.5.6\pptx\__init__.py", line 15, in <module>
from pptx.api import Presentation # noqa
File "D:/apera/python27/python-pptx-0.5.6\pptx\api.py", line 14, in <module>
from pptx.package import Package
File "D:/apera/python27/python-pptx-0.5.6\pptx\package.py", line 16, in <module>
from .parts.image import Image, ImagePart
File "D:/apera/python27/python-pptx-0.5.6\pptx\parts\image.py", line 13, in <module>
import Image as PIL_Image
ImportError: No module named Image
and when i want to install PIL it can't install for 64 bit. Is there a ppt library that don't need PIL?
remove the PIL package due to conflicts with Pillow and python-pptx
Delete the PIL directory located in C:\Users\user1\AppData\Local\Continuum\Anaconda\Lib\site-packages\ or wherever your library is
run pip install python-pptx to install Pillow
I had about the same issue. When I updated the pillow library (pretty easy to do with Anaconda which I use) the issue was gone.
Uninstall Pillow
Uninstall python-pptx
Install Pillow
Install python-pptx
Run above commands using "pip". This worked for me.
I had the same problem.
My system is Windows XP 32bit and the python version is 2.7.13.
I just degraded the version of pillow and python-pptx. It worked for me
pip install pillow==3.1.0
pip install python-pptx==0.5.5

ImportError: No module named 'googlevoice'

python noob here. Just start picking up python few weeks ago and currently need some help. I have 3.3.4 python for windows 7 and I tried running this:
import urllib.request
from googlevoice import Voice
from googlevoice.util import input
import time
File "<pyshell#0>", line 1, in <module>
from googlevoice import Voice
ImportError: No module named 'googlevoice'
so I figured. no big deal, I just need to install the module. I obtained a setup.py file from the link below and ran the file in different directories. Then tried " import googlevoice" but still doesn't work. The github link isn't too helpful, in terms of installing this module. Please help? I think I just have not learned how to install modules properly. Last time it took me a while to install pygame module, but i think it was because of directory issues at first.
https://pygooglevoice.googlecode.com/hg/
http://sphinxdoc.github.io/pygooglevoice/examples.html
To install the PyGoogleVoice, you need to download the whole archive and execute:
python setup.py install
If you have pip install, you can also run pip install pygooglevoice, or easy_install pygooglevoice with EasyInstall, without having to download the source code.

Categories