Tried to download Python CSV file

I am trying to download a CSV file attached to this link "blob: https: //".

Every time I make these code requests, this exception is thrown: "request.exceptions.InvalidSchema: For & # 39; blob: https: //" no connection adapters were found .

Can someone help me solve this problem or explain why?

import requests
url = 'blob:' 
user_agent = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0) LinkCheck by'
headers = {'User-Agent': user_agent}
response = requests.get(url,headers=headers)

Web Scraping – Dynamic Web Scraper in Python

The other week I was struggling to scratch dynamically generated content. So I used the Selenium library with a combination of requests and BS4. I'm not sure how good the implementation is since I just learned how to use these tools. I want general feedback on how I used the libraries, the quality of my code, and the logic behind it.

Link to GitHub README.

from selenium import webdriver
from import Options
from import By
from import WebDriverWait
from import expected_conditions as ec
import selenium.common.exceptions
import requests
from bs4 import BeautifulSoup
from time import sleep

def scraper():
    opts = Options()
    driver = webdriver.Chrome(r'C:Usersleaguchromedriver.exe', options=opts)

    pos = input('Enter your desired position: ')
    URL = ''+pos.replace(' ', '+')

    # Scroll to the bottom of the page
    while True:
            WebDriverWait(driver, 5).until(
                    (By.CLASS_NAME, 'load_more_jobs'),
                    'Load more listings')
            loadMore = driver.find_element_by_class_name('load_more_jobs')
            try: # can't locate element - click the close on the popup add
                WebDriverWait(driver, 5).until(
                    ec.presence_of_element_located((By.CLASS_NAME, 'portstlucie-CloseButton'))
                addClose = driver.find_element_by_xpath('//*(@id="om-oqulaezshgjig4mgnmcn-optin")/div/button')
            except: # Timeout / can't locate add - break

    # Find all the job listings
    listings = driver.find_elements_by_class_name('job_listing')

    if len(listings) == 0:
        print(f'There are 0 jobs found by {pos} criteria. Please use different wording.')
        scrapeN = input(f"There are {len(listings)} number of jobs for the {pos} position. If u wish to view a portion of them enter the number of the jobs to view else write 'max': ")
        if scrapeN.lower() == 'max':
            scrapeN = len(listings)
        scrapeN = input(f"There are {len(listings)} number of jobs for the {pos} position. If u wish to view a portion of them enter the number of the jobs to view else write 'max': " )

    for i in range(int(scrapeN)): # Iterate trough all the job listings
        URL = listings(i).find_element_by_tag_name('a').get_attribute('href')
        html = requests.get(URL)
        soup = BeautifulSoup(html.content, 'html.parser')

        jobT = soup.find('h1', class_='font-weight-bold').text
        jobPD = soup.find('time').text
        link = soup.find('a', class_='application_button')('href')

        print(f'Job - {jobT}. This job was {jobPD}.nMore information about the job at {URL}. nLink for application - {link}', end='nn')

if __name__ == '__main__':

How do I run a Mathematica package (.m) from Python with the "Wolfram Client Library for Python"?

This question is about calling a Mathematica package (.m file) from Python using the "Wolfram Client Library for Python" (

For completeness, consider the following Mathematica package:

AddTwo::usage = "AddTwo(a, b) returns a+b";
AddTwo(a_, b_) := a + b;

target: Call Python's AddTwo from the Wolfram Client Library for Python. If this is not currently supported, add this feature to the library.

Documentation for the library can be found at:

A similar question asked before the Wolfram Client Library for Python was released is:
How do I run a Mathematica package (.m) from Python?

Python – A simple animation in pygame

I'm following a tutorial in Pygame. I realized that the sample code was written to be easy to understand. I wondered if I could "improve" the code, focusing on keeping the exact same functionality. I've tried, but I'm not sure if this is an improvement.

This is the original code from the instructions:

import pygame, sys
from pygame.locals import *


FPS = 30 # frames per second setting
fpsClock = pygame.time.Clock()

# set up the window
DISPLAYSURF = pygame.display.set_mode((400, 300), 0, 32)

WHITE = (255, 255, 255)
catImg = pygame.image.load('cat.png') # hosted at
catx = 10
caty = 10
direction = 'right'

while True: # the main game loop

    if direction == 'right':
        catx += 5
        if catx == 280:
            direction = 'down'
    elif direction == 'down':
        caty += 5
        if caty == 220:
            direction = 'left'
    elif direction == 'left':
        catx -= 5
        if catx == 10:
            direction = 'up'
    elif direction == 'up':
        caty -= 5
        if caty == 10:
            direction = 'right'

    DISPLAYSURF.blit(catImg, (catx, caty))

    for event in pygame.event.get():
        if event.type == QUIT:


This is my "improved" code. Two questions. How can my version in general be improved and why is this improvement better than my code? And how could the original be improved?

import pygame, sys
from pygame.locals import *


FPS = 30
fps_clock = pygame.time.Clock()

window_size = (400,300)
DISPLAYSURF = pygame.display.set_mode(window_size,0,32)
pygame.display.set_caption("Animation test!")

WHITE = (255,255,255)
cat = pygame.image.load('assests/cat.png') # hosted at
direction = 'right'
x_,y_ = 10,10

def listenToQuit():
    for event in pygame.event.get():
        if event.type == QUIT:

def detectCollision(cat,x,y,window_size):
    return cat.get_size()(0) + x >= window_size(0) or 
        cat.get_size()(1) + y  >= window_size(1) or 
            x <= 0 or y <= 0

def getDirection(direction):
    directions = ('right','down','left','up')
    idx = directions.index(direction)
    idx = 0 if idx + 1 == len(directions) else idx + 1
    return directions(idx)

def getMovement(x,y,direction):
    if direction == 'right':
        return x+5,y
    elif direction == 'down':
        return x , y+5
    elif direction == 'left':
        return x - 5 , y
    elif direction == 'up':
        return x , y - 5

i = 0
while 1:

    x,y = getMovement(x_,y_,direction)
    while detectCollision(cat,x,y,window_size):  # if there would be a collision, change direction 
        direction = getDirection(direction)
        x,y = getMovement(x_,y_,direction) # re-calculate movement, now avoiding collision

    x_,y_ = x,y



I specifically chose not to make the animated object a class. I will try to do this for myself as my next exercise.

Regex – Possible irregular operation of the re-module in Python

The following HTML tag structure (excerpt from another larger document) is available:

texto = '''

It is intended to extract the 4 labels that contain the classes a-size-base a-link-child breadcrumb-inline-links.

For reasons that are not relevant The original HTML document is considered to be faulty (which is why the use of analysis libraries such as BeautifulSoup is excluded). and the use of regular expressions is suggested as a solution as follows:

>>> import re
>>> z = re.findall(r'^(^n)+a-size-base a-link-child breadcrumb-inline-links(^n)+$', texto)
>>> z

The result is an empty list (No matches found), but if we go to a regular expression validator like this we get the expected result:

Enter the image description here

Why does the regular expression produce the expected result in the validator and not when it is implemented via the module? re?

Python – Django doesn't read & # 39; static & # 39; static files

Well, up to a point, everything was fine. Then I don't know what happened or whether I did something wrong and nothing else works. Django stopped reading the static files.

When I try to go to a page in my application, I get the following error:
Insert picture description here

I checked my code several times but found no errors. The static part is as follows:

{% load static%}


And in the

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

    os.path.join(BASE_DIR, 'staticfiles'),

What worries me most is that the admin page ( doesn't work either. The following error is displayed:

Insert picture description here

My directories:

Insert picture description here

If you can help end this error, thank you very much!

Python – Generates a list with a loop

I want to create a list in which a loop is generated in such a way that

x = 1

while x <= 20:
x = x * 3.23

Something like that, but put all the results in a single list and without decimals

Something of this style:

#quiero esto:
(1, 3, 10)

#pero tengo esto:

If there is another way to make a list with such a pattern, it would help me too

Python – clarification of Zxx and finding certain sizes that result from a Scipy STFT

When I tried to isolate noise (rain in this case) from a speech, I used Scipy's STFT. However, I have a little difficulty understanding the outputs of the STFT.
I know that f represents the frequency ranges and t the time ranges, but I am confused as to what Zxx represents (for example, if I were to print (Zxx), what values ​​would be returned to be represented?). I also wonder where I can find the sizes associated with the STFT (for example, to find the lowest size of the STFT) and how I can relate that size to the specific time it occurs and its frequency.
I am relatively new to signal processing and any help would be greatly appreciated!

You can find the WAV file here

Sampling rate = 48000

nperseg = 1024

NFFT = 513

from matplotlib import pyplot as plt
import matplotlib.pyplot as plt
from import wavfile
from scipy import signal

wav_file_name = ('fox_rain.wav’)
samplerate, data =
data = data(:, 0)

f, t, Zxx = signal.stft(data, fs=samplerate, nperseg=1024)

#Pxx, freqs, bins, im = plt.specgram(data, Fs=samplerate, NFFT=1024)

length = data.shape(0) / samplerate
time = np.linspace(0., length, data.shape(0))

fig, ax = plt.subplots(nrows=1, ncols=3, figsize=(13, 8))

ax(0).plot(time, data) #signal
ax(1).specgram(data, Fs=samplerate, NFFT=1024) #matplotlib spectrogram 

ax(2).pcolormesh(t, f, np.abs(Zxx)) #scipy STFT 

ax(2).set_xlabel("Time (s)") 
ax(2).set_ylabel("Frequency (Hz)") 
ax(1).set_xlabel("Time (s)")
ax(0).set_xlabel("Time (s)")

#plt.xlim(0, length)
#plt.ylim(0, 5000)


Which graphical user interface should be used to move files with Python

I'm interested in starting a Python project that processes files and interacts with SQLite databases. The idea is that the user can select a file on his computer via a graphical interface and move it to the predefined folder in the program and save the path in a database so that it can be restored later. Which library should I use to develop this program? And is it possible to display PDFs after moving?

python 3.x – A standalone implementation of the parser generator

This is a leisure project. I tried to create a parser generator with a grammar inspired by

Unfortunately, it was much more difficult than I expected to understand the syntax of a certain grammar (meta-grammar?) Than I expected.

I call it KiloGrammar (sorry for the bad pun).

It was very different from what I had planned, but it seems to do the job.
It actually describes a batch machine and is probably Turing complete, although I haven't had the time to implement something like Rule 110 to check it out.

Here is an excerpt from a grammar to analyze simple mathematical expressions:

# this grammar parses simple math expressions like: a + 10 * (8 + 5)

token var "(A-Za-z)+"
token int "-?(0-9)+"
token float "-?(0-9+)+.(0-9)+"
token whitespace "( s)+"
keyword "("
keyword ")"
keyword "+"
keyword "-"
keyword "*"
keyword "/"

shorthand "NUMBER" "int|float|var"
shorthand "operation" "+|-|*|/"

rule ignore_whitespace (whitespace)

rule math_priority (ADD|SUB, *|/, EXPRESSION)
    pop(3); push((0)(1), (0)(0), (0)(2), (1), (2))

rule math (EXPRESSION, operation, EXPRESSION)

rule parenthesis ("(", EXPRESSION, ")")
    pop(3); push((1))

You can find the complete implementation here:

You can do it with: python some_input_grammar.txt -compile >

To easily test your new parser python some_input.txt -color It should print a syntax tree.

or to see how the syntax tree is built: python some_input.txt -interactive -color

it also works for the parser generator itself: python some_input_grammar.txt -interactive -color

Although I thought it was a toy project and I had no idea what I was doing, I would like to know your thoughts about the usability and quality of the project, especially the meta-grammar (?) It uses.