I'm trying to set up a Python script to run through a batch file for Windows Task Scheduler and I'm running into an error when running the file.
The code works in both my Jupyter Notebook and PyCharm, but fails when trying to run through a batch file.
Modules imported within the script:
from pyathena import connect
import pandas as pd
import numpy as np
import win32com.client as win32
import datetime
from IPython.display import HTML
Error Message:
C:\Users\jraines\Desktop>"C:\Users\jraines\AppData\Local\Continuum\anaconda3\python.exe" "C:\Users\jraines\Downloads\Partners Email New.py"
Traceback (most recent call last):
File "C:\Users\jraines\Downloads\Partners Email New.py", line 27, in <module>
region_name='us-east-1')
File "C:\Users\jraines\AppData\Local\Continuum\anaconda3\lib\site-packages\pyathena\__init__.py", line 54, in connect
from pyathena.connection import Connection
File "C:\Users\jraines\AppData\Local\Continuum\anaconda3\lib\site-packages\pyathena\connection.py", line 9, in <module>
from boto3.session import Session
File "C:\Users\jraines\AppData\Local\Continuum\anaconda3\lib\site-packages\boto3\__init__.py", line 16, in <module>
from boto3.session import Session
File "C:\Users\jraines\AppData\Local\Continuum\anaconda3\lib\site-packages\boto3\session.py", line 17, in <module>
import botocore.session
File "C:\Users\jraines\AppData\Local\Continuum\anaconda3\lib\site-packages\botocore\session.py", line 30, in <module>
import botocore.credentials
File "C:\Users\jraines\AppData\Local\Continuum\anaconda3\lib\site-packages\botocore\credentials.py", line 42, in <module>
from botocore.utils import InstanceMetadataFetcher, parse_key_val_file
File "C:\Users\jraines\AppData\Local\Continuum\anaconda3\lib\site-packages\botocore\utils.py", line 31, in <module>
import botocore.httpsession
File "C:\Users\jraines\AppData\Local\Continuum\anaconda3\lib\site-packages\botocore\httpsession.py", line 7, in <module>
from urllib3.util.ssl_ import (
ImportError: cannot import name 'ssl' from 'urllib3.util.ssl_' (C:\Users\jraines\AppData\Local\Continuum\anaconda3\lib\site-packages\urllib3\util\ssl_.py)
When I run my script in my Jupyter Notebook and PyCharm I don't see this error message, but when I run it on the command line I get the error above. I do have the "C:\Users\jraines\AppData\Local\Continuum\anaconda3\lib\site-packages\urllib3\ssl_.py" file installed as well.
I use this steps solved the issue. my python version is 3.7.4.
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel
reinstall python3.7.4
import ssl is ok
Related
I am trying to make a python program that gets stock market data. I have not started it yet because the requests_html library has an error. My program will use the python library, yahoo_fin, and yahoo_fin uses requests_html, which is not working. I have already successfully installed all the other necessary dependencies, including ftplib and pandas.
I have already tried installing requests_html using various console commands. First I tried using:
pip3 install requests_python
The library did install, but returned errors when i tried to import it into my program. Then I researched it, and some people apparently found success with this command:
pip3 install requests-python
However, neither of these worked and I was left with these error messages both times:
>>> import requests_html
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/requests_html.py", line 9, in <module>
import pyppeteer
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyppeteer/__init__.py", line 30, in <module>
from pyppeteer.launcher import connect, launch, executablePath # noqa: E402
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyppeteer/launcher.py", line 24, in <module>
from pyppeteer.browser import Browser
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyppeteer/browser.py", line 13, in <module>
from pyppeteer.connection import Connection
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyppeteer/connection.py", line 12, in <module>
import websockets
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websockets/__init__.py", line 3, in <module>
from .auth import *
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websockets/auth.py", line 15, in <module>
from .server import HTTPResponse, WebSocketServerProtocol
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websockets/server.py", line 49, in <module>
from .protocol import WebSocketCommonProtocol
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websockets/protocol.py", line 18, in <module>
from typing import (
ImportError: cannot import name 'Deque'
And when I try to use the yahoo_fin library I get this message:
Warning - Certain functionality requires requests_html,
which is not installed. Install using:
pip install requests_html
After installation, you may have to restart your Python session.
I have already tried using
pip install requests_html
but it installs the library to python 2.7.15, the default python version on my computer.
you need to change /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websockets/protocol.py file import deque from collections instead of type
I have the Anaconda distribution of Python 2.7 and I needed to install the Jupyter notebook package. During the installation process my computer turned off and after that I couldn't continue with the process. I tried to uninstall Jupyter and try installing it again, but I keep getting the same error:
Traceback (most recent call last):
File "C:\Users\Acer\Anaconda\Scripts\ipython-script.py", line 3, in <module>
from IPython import start_ipython
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\__init__.py", line 49, in <module>
from .terminal.embed import embed
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\terminal\embed.py", line 19, in <module>
from IPython.terminal.ipapp import load_default_config
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\terminal\ipapp.py", line 22, in <module>
from IPython.core.completer import IPCompleter
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\core\completer.py", line 71, in <module>
from IPython.utils import generics
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\utils\generics.py", line 8, in <module>
from simplegeneric import generic
ImportError: No module named simplegeneric
What should I remove/add in order to make it work?
You need to install the python package simplegeneric. After you install it, you need to install the next package that you fail to import. Continue this process until you dont get any import errors.
I have set up an all in one swift. While setting up keystone in all-in-one-swift I am having an error when I try to create the service entity and API endpoints. I followed liberty documentation but couldn't resolve this issue!
Documentation link
[root#arupsaio ~]# openstack service create --name keystone --description "OpenStack Identity" identity
Traceback (most recent call last):
File "/usr/bin/openstack", line 6, in <module>
from openstackclient.shell import main
File "/usr/lib/python2.7/site-packages/openstackclient/shell.py", line 30, in <module>
from openstackclient.common import clientmanager
File "/usr/lib/python2.7/site-packages/openstackclient/common/clientmanager.py", line 23, in <module>
import requests
File "/usr/lib/python2.7/site-packages/requests/__init__.py", line 58, in <module>
from . import utils
File "/usr/lib/python2.7/site-packages/requests/utils.py", line 32, in <module>
from .exceptions import InvalidURL, FileModeWarning
ImportError: cannot import name FileModeWarning
In my case, there were some package leftovers.
I had to uninstall the package 3 times!
pip uninstall requests # x3
And then reinstall the new version
pip install requests
I'm trying to install py2neo on an offline machine. I can't use pip because I'm not connected to the internet. I'm trying to install py2neo-2.0.3 with python2.7.9 on redhat. When I run python setup.py install I get ImportError: cannot import name HTTPSConnection.
Traceback (most recent call last):
File "setup.py", line 29, in <module>
from py2neo import __author__, __email__, __license__, __package__, __version__
File "usr/lib/py2neo-2.0.3/py2neo/__init__.py" line 27, in <module>
from py2neo.core import *
File "usr/lib/py2neo-2.0.3/py2neo/core.py", line 28, in <module>
from py2neo.env import NEO4J_AUTH_TOKEN, NEO4J_URI
File "usr/lib/py2neo-2.0.3/py2neo/env.py", line 21, in <module>
from py2neo.packages.httpstream.packages.urimagic import URI
File "usr/lib/py2neo-2.0.3/py2neo/packages/httpstream/__init__.py", line 32, in <module>
from .http import *
File "usr/lib/py2neo-2.0.3/py2neo/packages/httpstream/http.py", line 31, in <module>
from httplib import (BadStatusLine, CannotSendRequest,
ImportError: cannot import name HTTPSConnection
I've tried installing httpstream but that didn't fix the import error.
HTTPSConnection should come with the standard library and isn't part of py2neo itself:
https://docs.python.org/2/library/httplib.html#httplib.HTTPSConnection
I don't know specifically about how RedHat package Python but it's possible you need to install SSL support in addition to the main language. I believe this is a separate compilation option:
http://www.webtop.com.au/blog/compiling-python-with-ssl-support-fedora-10-2009020237
I download trunk version of OpenERP from lauchpad. When i start server it's gives following error
Traceback (most recent call last):
File "./openerp-server", line 2, in
import openerp
File "/home/jack/trunk/trunk-server/openerp/init.py", line 72, in
import http
File "/home/jack/trunk/trunk-server/openerp/http.py", line 37, in
from openerp.service import security, model as service_model
File "/home/jack/trunk/trunk-server/openerp/service/init.py", line 28, in
import server
File "/home/jack/trunk/trunk-server/openerp/service/server.py", line 10, in
import psutil
ImportError: No module named psutil
Getting this error because psutil is not installed. you have to install psutil using this command.
sudo apt-get install python-psutil in terminal. after this restart server. This will solve your error.