What is the requirements.txt, what should be in it? - python

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

Related

ImportError: cannot import name 'Option' from 'discord'

I can't run my code, because of this
Can someone help me ?
ImportError: cannot import name 'Option' from 'discord'
My imports are
import discord
import datetime
from discord import Option
from discord.ext import commands
from discord.ext.commands import MissingPermissions
from discord_components import Button, Select, SelectOption, ComponentsBot, interaction
from discord_components.component import ButtonStyle
from discord_slash import SlashCommand
from discord_slash.utils.manage_commands import create_option
That's happening because you just installed an external API wrapper so now you aren't using discord.ext I would recommend you remove pycord or you will have to rewrite all of your code.
You need to install the developer version of pycord...
pip install git+https://github.com/Pycord-Development/pycord
or
py -3 -m pip install -U py-cord

import "unittest2" could not be resolved Pylance

I'm getting this error in my Python code for raspberry pi.
import os
import subprocess
import sys
import warnings
import time
from threading import Timer
import RPi.GPIO as GPIO
if sys.version[:3] == '2.6':
import unittest2 as unittest
else:
import unittest

Can't import class and module on Python progrram

I do not program on Python, so I don't know what the problem is.
I just can't start the program from the command line, this is displayed:
Here is code __init__.py
import os
import sys
from PyQt4 import QtGui, QtCore
from pynfb.experiment import Experiment
from pynfb.io.xml_ import xml_file_to_params
from pynfb.settings_widget.general import GeneralSettingsWidget
from pynfb.settings_widget.inlet import InletSettingsWidget
from pynfb.settings_widget.protocol_sequence import ProtocolSequenceSettingsWidget
from pynfb.settings_widget.protocols import ProtocolsSettingsWidget, FileSelectorLine
from pynfb.settings_widget.signals import SignalsSettingsWidget
from pynfb.settings_widget.composite_signals import CompositeSignalsSettingsWidget
from pynfb.settings_widget.protocols_group import ProtocolGroupsSettingsWidget
static_path = os.path.realpath(os.path.dirname(os.path.realpath(__file__)) + '/static')
class SettingsWidget(QtGui.QWidget):
You need to install PyQt4 first: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyqt4.
Download the correct file corresponding to the version of your python, e.g. PyQt4‑4.11.4‑cp37‑cp37m‑win_amd64.whl then install by using pip (https://pip.pypa.io/en/stable/installing/)
pip install PyQt4-4.11.4-cp37-none-win_amd64.whl

Spyder (Python 3.6) wkhtmltopdf ModuleNotFoundError: No module named 'main'

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

tornado.database Importerror: No module named database

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.

Categories

Resources