I'm using a fork of Bret Taylor's 'socialcookbook' (https://github.com/finiteloop/socialcookbook) which uses "import tornado.database" - and it's worked perfectly until yesterday (the 3.01 build?) and now I'm getting an ImportError: no module named database when I compile on Heroku (using Python).
My requirements.txt file is simple:
mysql-python
tornado
My import statements:
import base64
import datetime
import functools
import json
import hashlib
import hmac
import time
import logging
import os
import smtplib #for mandrill email notifications
import httplib #for custom error handler
import re
import string
import tornado.database
import tornado.escape
import tornado.httpclient
import tornado.ioloop
import tornado.web
import urllib
import urllib2
import urlparse
from tornado.options import define, options
import facebook
Any thoughts? I'm having a hard time troubleshooting this one and I can't push new builds (old builds work fine if I rollback on Heroku, though, oddly..)
As it turns out, Tornado 3.0 has deprecated tornado.database and replace it with torndb: https://github.com/bdarnell/torndb
So the fix is to simply replace all tornado.database references with torndb and add torndb to the requirements.txt file.
Related
I am switching from replit to pebblehost to host my python bot. What do I put in my requirements.txt?
These are the imports that I have at the start of my bot.
import asyncio
import datetime
import functools
import io
import json
import os
import random
import re
import string
import urllib.parse
import urllib.request
import time
from urllib import parse, request
from itertools import cycle
from bs4 import BeautifulSoup as bs4
import cloudscraper
import discord, time
import random, threading
import asyncio
from discord.ext import commands
import aiohttp
import colorama
import discord
import numpy
import requests
from time import sleep
from discord import Permissions
from discord.ext import commands
from discord.utils import get
You just write the Packages you‘ve installed in it.
If you write >= 1.17 the version has to be higher than 1.17
Like:
Discord.py
Pillow
I'm a relatively inexperienced programmer and I ran these import statements last week on my computer without a problem but now this week when I run the following statements in particular the wkhtmltopdf import I run into an error.
import pyodbc
import pymysql
import numpy as np
import pandas as pd
import datetime
import jinja2
import wkhtmltopdf
from wkhtmltopdf.main import WKhtmlToPdf
import datetime
import calendar
from pathlib import Path
This leads to this error
enter image description here
Any help is appreciated
I coded this:
from datetime import datetime, timedelta
import json
import time
import urllib2
...
req=urllib2.Request(api_url,binary_data,header)
f=urllib2.urlopen(req)
My python version is the 3.6.5 so i´m supposed to have the urllib2 installed already but every time i get this error:
import urllib2
ModuleNotFoundError: no module named 'URLLIB2'
I changed the name to urllib3 as it appears in my anaconda folder but it crashes anyway....
what do i do?
Urllib2 is meant for Python 2, it is no longer used in Python 3. The standard module is now called urllib (you can find the documentation for it here: https://docs.python.org/3/library/urllib.html).
Try this instead:
import urllib.request
req=urllib.request.Request(api_url,binary_data,header)
f=urllib.request.urlopen(req)
urllib.request.Request(): https://docs.python.org/3/library/urllib.request.html#urllib.request.Request
urllib.request.urlopen():https://docs.python.org/3/library/urllib.request.html#urllib.request.urlopen
I'm getting the following error while running a flask app:
from gevent.wsgi import WSGIServer
ModuleNotFoundError: No module named 'gevent.wsgi'
gevent is already installed and the requirement is satisfied.
Pip version is 10.11 and Python 3.6.
OS: Windows 10 x64
Using Anaconda VM
This same code worked in another machine, so somewhere I am missing configuration, but I can't track/find it.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import json
from pprint import pprint
from rasa_core.channels import HttpInputChannel
from rasa_core import utils
from rasa_core.agent import Agent
from rasa_core.interpreter import RasaNLUInterpreter
from rasa_core.channels.channel import UserMessage
from rasa_core.channels.direct import CollectingOutputChannel
from rasa_core.channels.rest import HttpInputComponent
from flask import Blueprint, request, jsonify, abort
def run(serve_forever=True):
#path to your NLU model
interpreter = RasaNLUInterpreter("models/nlu/default/current")
# path to your dialogues models
agent = Agent.load("models/dialogue", interpreter=interpreter)
#http api endpoint for responses
input_channel = SimpleWebBot()
if serve_forever:
agent.handle_channel(HttpInputChannel(5004, "/chat", input_channel))
return agent
if __name__ == '__main__':
utils.configure_colored_logging(loglevel="INFO")
run()
Try using:
from gevent.pywsgi import WSGIServer
Instead of:
from gevent.wsgi import WSGIServer
The import statement you quoted needs to be updated to:
from gevent.pywsgi import WSGIServer
The gevent.wsgi module has been deprecated and was removed when gevent 1.3 was released. Its replacement is the gevent.pywsgi module, which has been around for some time.
It looks like in your case, the rasa-core library you're using is the one with the bad import line. This was fixed starting in the 0.9.0 release, so you should update that dependency to a newer version.
Are you able to tell me why I cannot use the request_kerberos module ? this is my code:
from django.http import HttpResponseNotFound ,HttpResponseRedirect
import requests
from requests_kerberos import HTTPKerberosAuth, OPTIONAL
I have already installed this module ,but when I'm opening the webpage I see that:
No module named winkerberos
I've checked the code and the problem is here ,kerberos.py file, first 4 lines:
try:
import kerberos
except ImportError:
import winkerberos as kerberos
winkerberos is for Windows OS and I'm using the CentOS
So, why my system cannot import that module ?