Categories
Mastering Development System & Network

CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team

I’m trying to run docker-compose (which was installed via pip), yet running into following error: # pip install –quiet docker-compose # docker-compose ps /usr/local/lib/python2.7/dist-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release. from cryptography.hazmat.backends import […]

Categories
Mastering Development

Function that I made for my own Python library is not working

I’m making an library and I have this function; def wait(seconds: float): import time time.sleep(seconds) del time When I try to run this function with using wait(1), I get this error; Traceback (most recent call last): File "test.py", line 3, in <module> wait(1) NameError: name ‘wait’ is not defined I tried to use advio.wait(1) and […]

Categories
Cryptocurrency Ethereum Mastering Development

This library has been renamed to `eth-utils`. The `ethereum-utils` package will no longer recieve updates. Please update your dependencies accordingly

I work on Ethereum Blockchain with Python when I connect Python with Smart Contract through python3 "Python File Name" .py I get this error Traceback (most recent call last): File "1_accounts.py", line 2, in <module> from web3 import Web3 File "/home/esraa/.local/lib/python3.8/site-packages/web3/__init__.py", line 6, in <module> from eth_account import ( File "/home/esraa/.local/lib/python3.8/site-packages/eth_account/__init__.py", line 1, in <module> […]

Categories
Mastering Development

problem in using the microphone in a python speech recognizer in ubuntu 20.04

I am facing a problem in using the microphone in my ubuntu notebook (laptop). import speech_recognition as sr r = sr.Recognizer() with sr.Microphone(device_index=0) as source: # use the default microphone as the audio source audio = r.listen(source) # listen for the first phrase and extract it into audio data try: print("You said " + r.recognize_google_cloud(audio)) […]

Categories
Cryptocurrency Ethereum Mastering Development

web3 library has been renamed

when i run python 1_accounts.py I get the following error Traceback (most recent call last): File "1_accounts.py", line 2, in <module> from web3 import Web3 File "/home/esraa/.local/lib/python2.7/site-packages/web3/__init__.py", line 6, in <module> from web3.main import Web3 File "/home/esraa/.local/lib/python2.7/site-packages/web3/main.py", line 5, in <module> from web3.eth import Eth File "/home/esraa/.local/lib/python2.7/site-packages/web3/eth.py", line 18, in <module> from web3.utils.filters import ( […]

Categories
Linux Mastering Development Ubuntu

Running script using python3 instead of default python 2.7

I have written a python program to scrape certain websites… I am using scrapy which is a python framework. # m h dom mon dow command PATH=/usr/local/bin 1 6 * * * cd /home/ubuntu/scrapers/my_scraper && /home/ubuntu/.local/bin/scrapy crawl my_spider >> /tmp/scraper.log 2>&1 The above program is using python 2.7. I want it to be run using […]

Categories
Mastering Development

How are packages for the GCF obtained?

My question is with regard to the packages required for Cloud Functions. My GCF requires fastai which I have already included in the requirements.txt. In main.py, I have included import fastai. And I do not have fastai installed in my system. Since its a GCF, when the function is deployed shouldn’t it read the requirements.txt […]

Categories
Mastering Development

ModuleNotFoundError: No module named ‘Python3’

Using Python 3.8, issue occurred while importing. It’s very simple. But any changes in way of importing in python 3 ? Under main folder, below structure exists. a1.py import sys print(sys.version) from b.b1 import * b1.py import os print(os.getcwd()) When I execute python a/a1.py (under main), it prints python version but errors out while importing […]

Categories
Mastering Development

How to organize 2 level array to a custom dictionary format?

I’m trying to convert this array a = [ [‘A’,’B’,’C’], [1,33,45], [721,22,9] ] to a dictionary in order to have this output: b = { ‘A’:[1,721], ‘B’:[33,22], ‘C’:[45,9] } My current code is like this, getting this error: b = {} for i in range(1,len(a)): for j in range(len(a[i])): b[a[0][j]].append(a[i][j]) Traceback (most recent call last): […]

Categories
Mastering Development

RecursionError at /graphql. maximum recursion depth exceeded

Problem Definition: I have read the article about adding JWT authentication my project using graphene-jwt package from this official link. According to what is said in the tutorial, some changes should be applied to the project settings.py file: First of all the package should be installed: pip3 install django-graphql-jwt Add AuthenticationMiddleware to MIDDLEWARE variable. MIDDLEWARE […]