Giter Club home page Giter Club logo

realpython / materials Goto Github PK

View Code? Open in Web Editor NEW
4.7K 159.0 5.3K 140.32 MB

Bonus materials, exercises, and example projects for our Python tutorials

Home Page: https://realpython.com

License: MIT License

Python 21.85% HTML 37.87% CSS 0.38% JavaScript 17.07% Java 0.02% Jupyter Notebook 20.99% Emacs Lisp 0.02% C 0.01% C++ 0.01% Shell 0.03% Dockerfile 0.03% Rust 0.01% Vue 0.23% Cython 0.01% Procfile 0.01% Ren'Py 1.04% PowerShell 0.02% Jasmin 0.01% Perl 0.01% Brainfuck 0.43%

materials's Introduction

Real Python Materials

Bonus materials, exercises, and example projects for Real Python's Python tutorials.

Build Status: GitHub Actions

Got a Question?

The best way to get support for Real Python courses, articles, and code in this repository is to join one of our weekly Office Hours calls or to ask your question in the RP Community Chat.

Due to time constraints, we cannot provide 1:1 support via GitHub. See you on Slack or on the next Office Hours call 🙂

Adding Source Code & Sample Projects to This Repo (RP Contributors)

Running Code Style Checks

We use ruff and black to ensure a consistent code style for all of our sample code in this repository.

Run the following commands to validate your code against the linters:

$ ruff check .
$ black --check .

Running Python Code Formatter

We're using a tool called black on this repo to ensure consistent formatting. On CI it runs in "check" mode to ensure any new files added to the repo follow PEP 8. If you see linter warnings that say something like "would reformat some_file.py" it means that black disagrees with your formatting.

The easiest way to resolve these errors is to run Black locally on the code and then commit those changes, as explained below.

To automatically re-format your code to be consistent with our code style guidelines, run black in the repository root folder:

$ black .

materials's People

Contributors

acsany avatar andreburgaud avatar brendaweles avatar bryanwweber avatar bsolomon1124 avatar bzaczynski avatar dbader avatar dependabot[bot] avatar eyrei123 avatar gahjelle avatar iansedano avatar jablonskidev avatar jaclynn avatar jaschmitt avatar jasminefiner avatar jayascript avatar jfincher42 avatar jima80525 avatar katefinegan avatar kylestratis avatar lpozo avatar martin-martin avatar pedropregueiro avatar somacdivad avatar spacerest avatar stephengruppetta avatar techiediaries avatar writeson avatar ysbecca avatar znunu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

materials's Issues

flask-connexion-rest-part-4 incompatible with newer package versions

I'm trying to port flask-connexion-rest-part-4 to the latest versions of all package dependencies and after fixing a few incompatibilities (that I can share) the server is running, but when accessing just "/" it fails with this error:

ValueError: Invalid fields for <NotePersonSchema(many=False)>: {'notes'}.

Any suggestions on what's causing this?

python-bindings/overview_article. No module named `cffi`

Hi,
I'm following through your excellent article: Python-bindings

Specs: Mac OS Mojave, pyenv, Python 3.7.7.

On invoke build-cmult, I get the following error. I had to explicitly install cffi to make it work.

(venv) ➜  overview_article git:(master) invoke build-cmult
Traceback (most recent call last):
  File "/Users/rabraham/Documents/dev/python/materials/venv/bin/invoke", line 10, in <module>
    sys.exit(program.run())
  File "/Users/rabraham/Documents/dev/python/materials/venv/lib/python3.7/site-packages/invoke/program.py", line 373, in run
    self.parse_collection()
  File "/Users/rabraham/Documents/dev/python/materials/venv/lib/python3.7/site-packages/invoke/program.py", line 465, in parse_collection
    self.load_collection()
  File "/Users/rabraham/Documents/dev/python/materials/venv/lib/python3.7/site-packages/invoke/program.py", line 696, in load_collection
    module, parent = loader.load(coll_name)
  File "/Users/rabraham/Documents/dev/python/materials/venv/lib/python3.7/site-packages/invoke/loader.py", line 76, in load
    module = imp.load_module(name, fd, path, desc)
  File "/Users/rabraham/.pyenv/versions/3.7.7/lib/python3.7/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/Users/rabraham/.pyenv/versions/3.7.7/lib/python3.7/imp.py", line 171, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 696, in _load
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/rabraham/Documents/dev/python/materials/python-bindings/overview_article/tasks.py", line 3, in <module>
    import cffi
ModuleNotFoundError: No module named 'cffi'

BlockingIOError: [WinError 10035] A non-blocking socket operation could not be completed immediately

When running the example multiconn-client and multiconn-server I get an error:

D:\git\PythonSocketProgramming\PythonSocketProgramming>python multiconn-client.py '127.0.0.1' 65432 1
starting connection 1 to ('127.0.0.1', 65432)
Traceback (most recent call last):
File "multiconn-client.py", line 60, in
start_connections( host, int(port), int(num_cons) )
File "multiconn-client.py", line 21, in start_connections
sock.connect( server_addr )
BlockingIOError: [WinError 10035] A non-blocking socket operation could not be completed immediately

AttributeError: 'Marshmallow' object has no attribute 'ModelSchema'

When running the build_database file that imports a model to create a table and serialize the data, i get this error AttributeError: 'Marshmallow' object has no attribute 'ModelSchema'.

models.py code

from datetime import datetime
from config import db, ma

class Person(db.Model):
    __tablename__ = 'person'
    person_id = db.Column(db.Integer, primary_key=True)
    last_name = db.Column(db.String(32), index=True)
    first_name = db.Column(db.String(32))
    timestamp = db.Column(db.DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)


# Serialize data

class PersonSchema(ma.ModelSchema):
    class Meta:
        model = Person
        sqla_session = db.session

AsyncIO only prints the single url

The https://www.jython.org url is never downloaded based on what is printed out

Steps to recreate:

git clone [email protected]:realpython/materials.git real_python_materials
cd real_python_materials/
python3.6 -m venv 36env
source 36env/bin/activate
pip install aiohttp

Running the script:

python io_asyncio.py 
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Read 273 from http://olympus.realpython.org/dice
Downloaded 160 sites in 3.151465892791748 seconds

redirect_uri_mismatch http://127.0.0.1:5000/login/callback

I've really enjoyed the content. Found the blog re "Create a Flask Application With Google Login"
https://realpython.com/flask-google-login/

https://github.com/realpython/materials/blob/master/flask-google-login/

I got to running the app and this error.

Error: redirect_uri_mismatch
The redirect URI in the request, http://127.0.0.1:5000/login/callback, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs, visit: https://console.developers.google.com/apis/credentials/oauthclient/310636517232-hh287vg31jbjbqe0hguc2ahmtqcrbr13.apps.googleusercontent.com?project=310636517232

I have setup nginx to redirect a domain to my flask server. Loads on a https page with a valid cert generated by certbot.
have configured my google app with my domain url.
have a working route at mydomain/login/callback

I can't see where http://127.0.0.1:5000 is set in my code. I did find old stackexchange references to setting the redirect instead of accepting the default (java examples not python).

The as published demo with redirection to localhost was working for me previously. (have deleted the previously working with localhost google app and created new google app, updated environment variables etc. exited shell, restarted ubuntu etc.

ideas?

ValueError at /blog/5/ The QuerySet value for an exact lookup must be limited to one result using slicing.

Request Method: GET
http://127.0.0.1:8000/blog/5/
2.2.1
ValueError
The QuerySet value for an exact lookup must be limited to one result using slicing.
C:\Users\UPosia\Anaconda3\envs\conjango\lib\site-packages\django\db\models\lookups.py in process_rhs, line 257
C:\Users\UPosia\Anaconda3\envs\conjango\python.exe
3.7.3
['F:\My_Django\personal_portfolio\src', 'C:\Users\UPosia\Anaconda3\envs\conjango\python37.zip', 'C:\Users\UPosia\Anaconda3\envs\conjango\DLLs', 'C:\Users\UPosia\Anaconda3\envs\conjango\lib', 'C:\Users\UPosia\Anaconda3\envs\conjango', 'C:\Users\UPosia\Anaconda3\envs\conjango\lib\site-packages']
Fri, 9 Aug 2019 11:31:32 +0000

pull request 112

I have posted a pull request #112 about a few weeks ago and wondering what's involved to get someone to approve and review perhaps. Thanks.

Specifying python.h and pybind11 path in windows

Hello everyone, and thanks for this great material.
I am trying to use cython to import a C++ library in Python.
I followed the instructions in Python Bindings: Calling C or C++ From Python, but I have a problem.
Everything is fine till I run "invoke build-cython"
The g++ cannot find the path for python and pybind11 directory. The error is:
Issue1

I guess the line ""-I /usr/include/python3.7 -I . "" in tasks.py file (line 132) does not work for me. Am I right? (is it because I'm using Windows?)
Can anyone please help me to solve this issue?

Thank you in advance.
Vahid.

Wrong version linked for Building Out the Complete API

https://realpython.com/flask-connexion-rest-api/

Building Out the Complete API

Includes the paragraph
To achieve this, you’ll extend both the swagger.yml and people.py files to fully support the API defined above. For the sake of brevity, only a link will be provided for both files:

swagger.yml
people.py

The links are to the version_2 files, which are not "extended" with the full API, so won't give the Swagger UI output that follows.

I believe you intended to use the version_3 files?

Error in tutorial for Last Template

In your tutorial, you refer to "The last template to create is the post_detail template.
This should be blog_detail.html. Using post instead of blog results in an error as the dir is looking for blog and not post.

django.db.migrations.exceptions.NodeNotFoundError: Migration shops.0002_auto_20201028_1829 dependencies reference nonexistent parent node ('nearbyshops', '0001_initial')

Got this error when i tried to migrate data from OSM for geoshop project. Followed the instructions but still got this error.

(env) C:\Users\Jane Huang\project\nearbyshops>py manage.py migrate
Traceback (most recent call last):
File "manage.py", line 22, in
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\Jane Huang\project\env\lib\site-packages\django\core\management_init_.py", line 401, in execute_from_command_line
utility.execute()
File "C:\Users\Jane Huang\project\env\lib\site-packages\django\core\management_init_.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Jane Huang\project\env\lib\site-packages\django\core\management\base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\Jane Huang\project\env\lib\site-packages\django\core\management\base.py", line 371, in execute
output = self.handle(*args, **options)
File "C:\Users\Jane Huang\project\env\lib\site-packages\django\core\management\base.py", line 85, in wrapped
res = handle_func(*args, **kwargs)
File "C:\Users\Jane Huang\project\env\lib\site-packages\django\core\management\commands\migrate.py", line 92, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "C:\Users\Jane Huang\project\env\lib\site-packages\django\db\migrations\executor.py", line 18, in init
self.loader = MigrationLoader(self.connection)
File "C:\Users\Jane Huang\project\env\lib\site-packages\django\db\migrations\loader.py", line 53, in init
self.build_graph()
File "C:\Users\Jane Huang\project\env\lib\site-packages\django\db\migrations\loader.py", line 255, in build_graph
self.graph.validate_consistency()
File "C:\Users\Jane Huang\project\env\lib\site-packages\django\db\migrations\graph.py", line 195, in validate_consistency
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "C:\Users\Jane Huang\project\env\lib\site-packages\django\db\migrations\graph.py", line 195, in
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "C:\Users\Jane Huang\project\env\lib\site-packages\django\db\migrations\graph.py", line 58, in raise_error
raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration shops.0002_auto_20201028_1829 dependencies reference nonexistent parent
node ('nearbyshops', '0001_initial')

Custom read handler for sockets demo for appserver.py and appclient.py (libserver, libclient)

ℹ️
https://github.com/realpython/materials/blob/master/python-sockets-tutorial/app-server.py
https://github.com/realpython/materials/blob/master/python-sockets-tutorial/app-client.py
https://github.com/realpython/materials/blob/master/python-sockets-tutorial/libserver.py
https://github.com/realpython/materials/blob/master/python-sockets-tutorial/libclient.py

You can report issues and problems here, but we typically won't be able to provide 1:1 support outside the channels listed above.

Describe the bug
I am trying to use the appclient and appserver demo from the above sockets tutorial and want to process a custom function using the data read from the server read or client read.

To Reproduce
NA

Expected behavior
Able to run a custom function after a read is done in server or client using the data read.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6] NA
  • OS: [e.g. iOS8.1] Linux, Windows
  • Browser [e.g. stock browser, safari] NA
  • Version [e.g. 22] NA

Additional context
NA

asyncio on mac m1

Hi.
I very much enjoyed your tutorial on concurrency in python.
I tested all of the examples you gave. One in particular irks me:
The async io-bound example is (by far!) the slowest on my mac m1 (10 cores) os 13.1.
Not sure why but it is significantly slower than the others.

I'd like to know if there is something in your code that needs to be tweaked
as I have an application I'm considering using async for part of.

Any idea why this would be ?

Thanks!

Using python 3.9.13 for this

127.0.0.1 took too long to respond Flask Google Login

Hi, I am trying to run the flask google login example. I have installed all the dependencies from requirements.txt. The first time I ran the app and I got, database initialized, as expected. Then, I ran it again, and I got running on https://127.0.0.1:5000 and all the other flask things. When I went to https://127.0.0.1:5000, it keeps on loading until it just returned, 127.0.0.1 took too long to respond.

Edit: I am using python3.8.3 64-bit and Windows 10.

Edit: I also tried with the newer versions of the packages, and that didn't work either.

Edit: I did make an OAuth key, and I copied the keys and put them in the python file (this was just for testing).

Getting Started with Django1

For someone following tutorial on the site:
The field on the model category is named as "title" while it is used as "name" is rest of the tutorial, wasted some time there.
Change it to "name" and apply migrations again.

Multiconnection server can't handle Connection Reset events

It seems the Muli-connection server example doesn't properly handle the Connection Reset Error;

Traceback (most recent call last):
  File "server.py", line 65, in <module>
    service_connection(key, mask)
  File "server.py", line 24, in service_connection
    recv_data = sock.recv(1024)  # Should be ready to read
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

This error occurs when, for example, the Windows Command Prompt running the client.py (connected to the server) is closed. In this case, a peer reset is sent to the server, but since the server can't handle it, it simply exits with the above error.

Is there any specific event to catch this error and avoid breaking the server?

Thanks
SS

Dependabot couldn't find a Pipfile for this project

Dependabot couldn't find a Pipfile for this project.

Dependabot requires a Pipfile to evaluate your project's current Python dependencies. It had expected to find one at the path: /requirements.txt/Pipfile.

If this isn't a Python project, or if it is a library, you may wish to disable updates for it in the .dependabot/config.yml file in this repo.

View the update logs.

Sockets of multi connect server's client do not close on minor change from eco server to normal server and normal client

ℹ️
After I use it (https://github.com/realpython/materials/blob/master/python-sockets-tutorial/multiconn-client.py) with a small change (minor change from echo server to normal server) -

- after sending and receiving messages from the client and server, the client does not close; or
- all data.messages have been exausted, the client does not close.

https://stackoverflow.com/questions/70640602/sockets-in-python-client-not-closing-after-event-read-write-events-in-multi-conn

You can report issues and problems here, but we typically won't be able to provide 1:1 support outside the channels listed above.

Describe the bug
After minor change from echo server to normal server:

- after sending and receiving messages from the client and server, the client does not close; or
- all data.messages have been exausted, the client does not close.

To Reproduce
Provided in the stackoverflow question

Expected behavior
The client should close. Looks like it does not get into the if not recv_data code while I was checking. The program should reach the code. No major changes to the code has been made other than sending data from messages section. :

if not recv_data:
    print("closing connection", data.connid)
    sel.unregister(sock)
    sock.close()

Screenshots
Added to link:
https://stackoverflow.com/questions/70640602/sockets-in-python-client-not-closing-after-event-read-write-events-in-multi-conn

Desktop (please complete the following information):

  • OS: [e.g. iOS] Win, Linux

Additional context
NA

concurrency-overview: Failed to install the requirements

I am on Lubuntu 22.04 LTS. Here is my console output (please ignore the strikeouts, looks like misinterpreted formatting):

eantonov@arrakis2:/Documents/PYTHONDEV/exercices/REALPYTHON/concurrency-overview$ python -m venv venv
eantonov@arrakis2:
/Documents/PYTHONDEV/exercices/REALPYTHON/concurrency-overview$ ls -la
total 60
drwxrwxr-x 3 eantonov eantonov 4096 апр 27 02:47 .
drwxrwxr-x 159 eantonov eantonov 12288 апр 27 02:46 ..
-rwxrwxr-x 1 eantonov eantonov 445 апр 27 02:46 cpu_mp.py
-rwxrwxr-x 1 eantonov eantonov 397 апр 27 02:46 cpu_non_concurrent.py
-rwxrwxr-x 1 eantonov eantonov 486 апр 27 02:46 cpu_threading.py
-rwxrwxr-x 1 eantonov eantonov 864 апр 27 02:46 io_asyncio.py
-rwxrwxr-x 1 eantonov eantonov 814 апр 27 02:46 io_mp.py
-rwxrwxr-x 1 eantonov eantonov 615 апр 27 02:46 io_non_concurrent.py
-rwxrwxr-x 1 eantonov eantonov 872 апр 27 02:46 io_threading.py
-rwxrwxr-x 1 eantonov eantonov 380 апр 27 02:46 race_condition.py
-rw-rw-r-- 1 eantonov eantonov 322 апр 27 02:46 README.md
-rw-rw-r-- 1 eantonov eantonov 551 апр 27 02:46 requirements.txt
drwxrwxr-x 5 eantonov eantonov 4096 апр 27 02:47 venv

eantonov@arrakis2:~/Documents/PYTHONDEV/exercices/REALPYTHON/concurrency-overview$ source venv/bin/activate

(venv) eantonov@arrakis2:~/Documents/PYTHONDEV/exercices/REALPYTHON/concurrency-overview$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy

(venv) eantonov@arrakis2:/Documents/PYTHONDEV/exercices/REALPYTHON/concurrency-overview$ python --version
Python 3.10.6
(venv) eantonov@arrakis2:
/Documents/PYTHONDEV/exercices/REALPYTHON/concurrency-overview$ pip --version
pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)

(venv) eantonov@arrakis2:~/Documents/PYTHONDEV/exercices/REALPYTHON/concurrency-overview$ pip install -r requirements.txt
Defaulting to user installation because normal site-packages is not writeable
Collecting aiohttp==3.4.4
Downloading aiohttp-3.4.4.tar.gz (822 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 822.1/822.1 KB 7.0 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting asks==2.0.0
Downloading asks-2.0.0.tar.gz (18 kB)
Preparing metadata (setup.py) ... done
Collecting astroid==2.0.4
Downloading astroid-2.0.4-py3-none-any.whl (172 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 172.8/172.8 KB 10.0 MB/s eta 0:00:00
Collecting async-generator==1.10
Downloading async_generator-1.10-py3-none-any.whl (18 kB)
Collecting async-timeout==3.0.1
Downloading async_timeout-3.0.1-py3-none-any.whl (8.2 kB)
Collecting atomicwrites==1.2.0
Downloading atomicwrites-1.2.0-py2.py3-none-any.whl (5.9 kB)
Collecting attrs==18.1.0
Downloading attrs-18.1.0-py2.py3-none-any.whl (28 kB)
Collecting certifi==2018.8.13
Downloading certifi-2018.8.13-py2.py3-none-any.whl (146 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 146.5/146.5 KB 944.1 kB/s eta 0:00:00
Collecting chardet==3.0.4
Downloading chardet-3.0.4-py2.py3-none-any.whl (133 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.4/133.4 KB 13.5 MB/s eta 0:00:00
Collecting contextvars==2.3
Downloading contextvars-2.3.tar.gz (9.6 kB)
Preparing metadata (setup.py) ... done
Collecting h11==0.8.1
Downloading h11-0.8.1-py2.py3-none-any.whl (55 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 55.8/55.8 KB 5.6 MB/s eta 0:00:00
Collecting idna==2.7
Downloading idna-2.7-py2.py3-none-any.whl (58 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 58.2/58.2 KB 16.3 MB/s eta 0:00:00
Collecting immutables==0.6
Downloading immutables-0.6.tar.gz (31 kB)
Preparing metadata (setup.py) ... done
Collecting isort==4.3.4
Downloading isort-4.3.4-py3-none-any.whl (45 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 45.4/45.4 KB 8.3 MB/s eta 0:00:00
Collecting lazy-object-proxy==1.3.1
Downloading lazy-object-proxy-1.3.1.tar.gz (32 kB)
Preparing metadata (setup.py) ... done
Collecting mccabe==0.6.1
Downloading mccabe-0.6.1-py2.py3-none-any.whl (8.6 kB)
Collecting more-itertools==4.3.0
Downloading more_itertools-4.3.0-py3-none-any.whl (48 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.5/48.5 KB 6.1 MB/s eta 0:00:00
Collecting multidict==4.4.2
Downloading multidict-4.4.2.tar.gz (118 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.4/118.4 KB 8.2 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Collecting multio==0.2.3
Downloading multio-0.2.3.tar.gz (5.8 kB)
Preparing metadata (setup.py) ... done
Collecting outcome==0.1.0
Downloading outcome-0.1.0-py2.py3-none-any.whl (4.9 kB)
Collecting pathlib2==2.3.2
Downloading pathlib2-2.3.2-py2.py3-none-any.whl (16 kB)
Collecting pluggy==0.7.1
Downloading pluggy-0.7.1-py2.py3-none-any.whl (14 kB)
Collecting py==1.6.0
Downloading py-1.6.0-py2.py3-none-any.whl (83 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 83.9/83.9 KB 11.6 MB/s eta 0:00:00
Collecting pycodestyle==2.3.1
Downloading pycodestyle-2.3.1-py2.py3-none-any.whl (45 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 45.2/45.2 KB 10.3 MB/s eta 0:00:00
Collecting pytest==3.7.3
Downloading pytest-3.7.3-py2.py3-none-any.whl (204 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 204.0/204.0 KB 1.1 MB/s eta 0:00:00
Collecting requests==2.19.1
Downloading requests-2.19.1-py2.py3-none-any.whl (91 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 92.0/92.0 KB 10.7 MB/s eta 0:00:00
Collecting six==1.11.0
Downloading six-1.11.0-py2.py3-none-any.whl (10 kB)
Collecting sniffio==1.0.0
Downloading sniffio-1.0.0-py3-none-any.whl (4.4 kB)
Collecting sortedcontainers==2.0.4
Downloading sortedcontainers-2.0.4-py2.py3-none-any.whl (28 kB)
Collecting tqdm==4.25.0
Downloading tqdm-4.25.0-py2.py3-none-any.whl (43 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 43.7/43.7 KB 3.0 MB/s eta 0:00:00
Collecting trio==0.6.0
Downloading trio-0.6.0-py3-none-any.whl (250 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 250.3/250.3 KB 3.8 MB/s eta 0:00:00
Collecting typed-ast==1.1.0
Downloading typed-ast-1.1.0.tar.gz (200 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 200.6/200.6 KB 9.1 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Collecting urllib3==1.23
Downloading urllib3-1.23-py2.py3-none-any.whl (133 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.3/133.3 KB 7.5 MB/s eta 0:00:00
Collecting wrapt==1.10.11
Downloading wrapt-1.10.11.tar.gz (27 kB)
Preparing metadata (setup.py) ... done
Collecting yarl==1.2.6
Downloading yarl-1.2.6.tar.gz (159 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 159.8/159.8 KB 11.1 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from pytest==3.7.3->-r requirements.txt (line 25)) (59.6.0)
Building wheels for collected packages: aiohttp, asks, contextvars, immutables, lazy-object-proxy, multidict, multio, typed-ast, wrapt, yarl
Building wheel for aiohttp (pyproject.toml) ... done
Created wheel for aiohttp: filename=aiohttp-3.4.4-py3-none-any.whl size=405398 sha256=e32b74bf67cff798beb53d5ee741101f4a239b0177114cd2487e918f38f8d75a
Stored in directory: /home/eantonov/.cache/pip/wheels/32/f6/ef/e2ddb73cd263f297a2329f5c0d2ec4d534fc8e125b4233fd48
Building wheel for asks (setup.py) ... done
Created wheel for asks: filename=asks-2.0.0-py3-none-any.whl size=21566 sha256=8136e73e49e1022d46f039d490cb17ce26ca260bcf9a721041873e0906a384c6
Stored in directory: /home/eantonov/.cache/pip/wheels/03/a2/9e/3c6051bb4ce7a1fc39d2d62a4ad2f77a5af61025c10c78c397
Building wheel for contextvars (setup.py) ... done
Created wheel for contextvars: filename=contextvars-2.3-py3-none-any.whl size=7681 sha256=98c946aba0fee3e4cbc26afa618d1adc441f579eb413d7776563565b3f24dc50
Stored in directory: /home/eantonov/.cache/pip/wheels/87/73/12/dead2e0e5b722e32551e1059f334779fd0cae016b33370d339
Building wheel for immutables (setup.py) ... done
Created wheel for immutables: filename=immutables-0.6-cp310-cp310-linux_x86_64.whl size=86391 sha256=c5d86e08af738b1828f20c4a90f99df1141653902f431eafffb46c85fc8205a6
Stored in directory: /home/eantonov/.cache/pip/wheels/95/54/9f/e327145b69adf3a5dd08bab5a4456983cf469b4d7d6fe8fb5d
Building wheel for lazy-object-proxy (setup.py) ... done
Created wheel for lazy-object-proxy: filename=lazy_object_proxy-1.3.1-cp310-cp310-linux_x86_64.whl size=57685 sha256=154954a669607c2ef9c3dbb1bf119e5f044b6fdd7e28656031079eeccbc9a281
Stored in directory: /home/eantonov/.cache/pip/wheels/27/59/c3/8b3e8756a940be2e2077e37dc4b1bfb18203a2c23e18d54567
Building wheel for multidict (setup.py) ... done
Created wheel for multidict: filename=multidict-4.4.2-py3-none-any.whl size=102510 sha256=f364c7f59b4aa1eb685420d7100787310d2201a0fefc8e55613bf683da1da397
Stored in directory: /home/eantonov/.cache/pip/wheels/5e/87/dc/19e6b23bef2258d76d2db81bbda671728ee8312f7838191cbc
Building wheel for multio (setup.py) ... done
Created wheel for multio: filename=multio-0.2.3-py3-none-any.whl size=6311 sha256=33884c7fa4ad34edb8c2eab329652c39fa1c7cae431fe408a6a82bb41a2d731f
Stored in directory: /home/eantonov/.cache/pip/wheels/7f/79/55/57804e80bd0f124b1f81eaf7420719d06057946b9ad0f9852d
Building wheel for typed-ast (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [248 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.10
creating build/lib.linux-x86_64-3.10/typed_ast
copying typed_ast/ast3.py -> build/lib.linux-x86_64-3.10/typed_ast
copying typed_ast/conversions.py -> build/lib.linux-x86_64-3.10/typed_ast
copying typed_ast/ast27.py -> build/lib.linux-x86_64-3.10/typed_ast
copying typed_ast/init.py -> build/lib.linux-x86_64-3.10/typed_ast
running build_ext
building '_ast27' extension
creating build/temp.linux-x86_64-3.10
creating build/temp.linux-x86_64-3.10/ast27
creating build/temp.linux-x86_64-3.10/ast27/Custom
creating build/temp.linux-x86_64-3.10/ast27/Parser
creating build/temp.linux-x86_64-3.10/ast27/Python
x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/usr/include/python3.10 -c ast27/Custom/typed_ast.c -o build/temp.linux-x86_64-3.10/ast27/Custom/typed_ast.o
In file included from ast27/Include/Python-ast.h:3,
from ast27/Custom/typed_ast.c:2:
ast27/Include/asdl.h:37:41: error: unknown type name ‘PyArena’
37 | asdl_seq *asdl_seq_new(Py_ssize_t size, PyArena *arena);
| ^~~~~~~
ast27/Include/asdl.h:38:49: error: unknown type name ‘PyArena’
38 | asdl_int_seq *asdl_int_seq_new(Py_ssize_t size, PyArena *arena);
| ^~~~~~~
In file included from ast27/Custom/typed_ast.c:2:
ast27/Include/Python-ast.h:397:63: error: unknown type name ‘PyArena’
397 | mod_ty _Ta27_Module(asdl_seq * body, asdl_seq * type_ignores, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:399:43: error: unknown type name ‘PyArena’
399 | mod_ty _Ta27_Interactive(asdl_seq * body, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:401:39: error: unknown type name ‘PyArena’
401 | mod_ty _Ta27_Expression(expr_ty body, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:403:65: error: unknown type name ‘PyArena’
403 | mod_ty _Ta27_FunctionType(asdl_seq * argtypes, expr_ty returns, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:405:37: error: unknown type name ‘PyArena’
405 | mod_ty _Ta27_Suite(asdl_seq * body, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:408:92: error: unknown type name ‘PyArena’
408 | decorator_list, string type_comment, int lineno, int col_offset, PyArena
| ^~~~~~~
ast27/Include/Python-ast.h:412:68: error: unknown type name ‘PyArena’
412 | decorator_list, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:414:65: error: unknown type name ‘PyArena’
414 | stmt_ty _Ta27_Return(expr_ty value, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:416:70: error: unknown type name ‘PyArena’
416 | stmt_ty _Ta27_Delete(asdl_seq * targets, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:419:34: error: unknown type name ‘PyArena’
419 | col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:422:25: error: unknown type name ‘PyArena’
422 | PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:424:91: error: unknown type name ‘PyArena’
424 | stmt_ty _Ta27_Print(expr_ty dest, asdl_seq * values, bool nl, int lineno, int col_offset, PyArena
| ^~~~~~~
ast27/Include/Python-ast.h:428:61: error: unknown type name ‘PyArena’
428 | type_comment, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:431:21: error: unknown type name ‘PyArena’
431 | PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:434:18: error: unknown type name ‘PyArena’
434 | PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:437:62: error: unknown type name ‘PyArena’
437 | type_comment, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:439:92: error: unknown type name ‘PyArena’
439 | stmt_ty _Ta27_Raise(expr_ty type, expr_ty inst, expr_ty tback, int lineno, int col_offset, PyArena
| ^~~~~~~
ast27/Include/Python-ast.h:443:37: error: unknown type name ‘PyArena’
443 | col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:445:93: error: unknown type name ‘PyArena’
445 | stmt_ty _Ta27_TryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno, int col_offset, PyArena
| ^~~~~~~
ast27/Include/Python-ast.h:448:77: error: unknown type name ‘PyArena’
448 | stmt_ty _Ta27_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:450:68: error: unknown type name ‘PyArena’
450 | stmt_ty _Ta27_Import(asdl_seq * names, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:453:38: error: unknown type name ‘PyArena’
453 | col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:456:20: error: unknown type name ‘PyArena’
456 | PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:458:68: error: unknown type name ‘PyArena’
458 | stmt_ty _Ta27_Global(asdl_seq * names, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:460:63: error: unknown type name ‘PyArena’
460 | stmt_ty _Ta27_Expr(expr_ty value, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:462:48: error: unknown type name ‘PyArena’
462 | stmt_ty _Ta27_Pass(int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:464:49: error: unknown type name ‘PyArena’
464 | stmt_ty _Ta27_Break(int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:466:52: error: unknown type name ‘PyArena’
466 | stmt_ty _Ta27_Continue(int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:468:83: error: unknown type name ‘PyArena’
468 | expr_ty _Ta27_BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:471:21: error: unknown type name ‘PyArena’
471 | PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:473:83: error: unknown type name ‘PyArena’
473 | expr_ty _Ta27_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:475:83: error: unknown type name ‘PyArena’
475 | expr_ty _Ta27_Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:477:93: error: unknown type name ‘PyArena’
477 | expr_ty _Ta27_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int col_offset, PyArena
| ^~~~~~~
ast27/Include/Python-ast.h:480:84: error: unknown type name ‘PyArena’
480 | expr_ty _Ta27_Dict(asdl_seq * keys, asdl_seq * values, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:482:64: error: unknown type name ‘PyArena’
482 | expr_ty _Ta27_Set(asdl_seq * elts, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:484:88: error: unknown type name ‘PyArena’
484 | expr_ty _Ta27_ListComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena
| ^~~~~~~
ast27/Include/Python-ast.h:487:87: error: unknown type name ‘PyArena’
487 | expr_ty _Ta27_SetComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena
| ^~~~~~~
ast27/Include/Python-ast.h:491:36: error: unknown type name ‘PyArena’
491 | col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:493:92: error: unknown type name ‘PyArena’
493 | expr_ty _Ta27_GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena
| ^~~~~~~
ast27/Include/Python-ast.h:496:64: error: unknown type name ‘PyArena’
496 | expr_ty _Ta27_Yield(expr_ty value, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:499:35: error: unknown type name ‘PyArena’
499 | col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:502:56: error: unknown type name ‘PyArena’
502 | kwargs, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:504:63: error: unknown type name ‘PyArena’
504 | expr_ty _Ta27_Repr(expr_ty value, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:506:57: error: unknown type name ‘PyArena’
506 | expr_ty _Ta27_Num(object n, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:508:68: error: unknown type name ‘PyArena’
508 | expr_ty _Ta27_Str(string s, int has_b, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:511:37: error: unknown type name ‘PyArena’
511 | col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:514:37: error: unknown type name ‘PyArena’
514 | col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:516:84: error: unknown type name ‘PyArena’
516 | expr_ty _Ta27_Name(identifier id, expr_context_ty ctx, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:518:86: error: unknown type name ‘PyArena’
518 | expr_ty _Ta27_List(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena
| ^~~~~~~
ast27/Include/Python-ast.h:521:87: error: unknown type name ‘PyArena’
521 | expr_ty _Ta27_Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena
| ^~~~~~~
ast27/Include/Python-ast.h:524:25: error: unknown type name ‘PyArena’
524 | slice_ty _Ta27_Ellipsis(PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:526:66: error: unknown type name ‘PyArena’
526 | slice_ty _Ta27_Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:528:42: error: unknown type name ‘PyArena’
528 | slice_ty _Ta27_ExtSlice(asdl_seq * dims, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:530:37: error: unknown type name ‘PyArena’
530 | slice_ty _Ta27_Index(expr_ty value, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:532:84: error: unknown type name ‘PyArena’
532 | comprehension_ty _Ta27_comprehension(expr_ty target, expr_ty iter, asdl_seq * ifs, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:535:50: error: unknown type name ‘PyArena’
535 | col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:538:66: error: unknown type name ‘PyArena’
538 | defaults, asdl_seq * type_comments, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:540:57: error: unknown type name ‘PyArena’
540 | keyword_ty _Ta27_keyword(identifier arg, expr_ty value, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:542:58: error: unknown type name ‘PyArena’
542 | alias_ty _Ta27_alias(identifier name, identifier asname, PyArena arena);
| ^~~~~~~
ast27/Include/Python-ast.h:544:45: error: unknown type name ‘PyArena’
544 | type_ignore_ty _Ta27_TypeIgnore(int lineno, PyArena arena);
| ^~~~~~~
ast27/Include/Python-ast.h:547:39: error: unknown type name ‘PyArena’
547 | mod_ty Ta27AST_obj2mod(PyObject
ast, PyArena
arena, int mode);
| ^~~~~~~
In file included from ast27/Custom/typed_ast.c:7:
ast27/Include/ast.h:8:49: error: unknown type name ‘PyArena’
8 | const char *, PyArena *);
| ^~~~~~~
ast27/Custom/typed_ast.c:209:54: error: unknown type name ‘PyArena’
209 | PyCompilerFlags *flags, PyArena *arena)
| ^~~~~~~
ast27/Custom/typed_ast.c: In function ‘string_object_to_py_ast’:
ast27/Custom/typed_ast.c:243:5: error: unknown type name ‘PyArena’
243 | PyArena *arena = PyArena_New();
| ^~~~~~~
ast27/Custom/typed_ast.c:243:22: warning: implicit declaration of function ‘PyArena_New’; did you mean ‘PyGen_New’? [-Wimplicit-function-declaration]
243 | PyArena *arena = PyArena_New();
| ^~~~~~~~~~~
| PyGen_New
ast27/Custom/typed_ast.c:243:22: warning: initialization of ‘int *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
ast27/Custom/typed_ast.c:247:11: warning: implicit declaration of function ‘string_object_to_c_ast’; did you mean ‘string_object_to_py_ast’? [-Wimplicit-function-declaration]
247 | mod = string_object_to_c_ast(str, filename, start, flags, arena);
| ^~~~~~~~~~~~~~~~~~~~~~
| string_object_to_py_ast
ast27/Custom/typed_ast.c:247:9: warning: assignment to ‘mod_ty’ {aka ‘struct _mod *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
247 | mod = string_object_to_c_ast(str, filename, start, flags, arena);
| ^
ast27/Custom/typed_ast.c:249:9: warning: implicit declaration of function ‘PyArena_Free’; did you mean ‘PyMem_Free’? [-Wimplicit-function-declaration]
249 | PyArena_Free(arena);
| ^~~~~~~~~~~~
| PyMem_Free
At top level:
ast27/Custom/typed_ast.c:200:1: warning: ‘err_free’ defined but not used [-Wunused-function]
200 | err_free(perrdetail *err)
| ^~~~~~~~
ast27/Custom/typed_ast.c:80:1: warning: ‘err_input’ defined but not used [-Wunused-function]
80 | err_input(perrdetail *err)
| ^~~~~~~~~
ast27/Custom/typed_ast.c:65:12: warning: ‘PARSER_FLAGS’ defined but not used [-Wunused-function]
65 | static int PARSER_FLAGS(PyCompilerFlags *flags)
| ^~~~~~~~~~~~
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for typed-ast
Running setup.py clean for typed-ast
Building wheel for wrapt (setup.py) ... done
Created wheel for wrapt: filename=wrapt-1.10.11-cp310-cp310-linux_x86_64.whl size=67631 sha256=6e1e5471aae9eecdc6ad288a361e8cbe091371b111a101522cbef3399451aff3
Stored in directory: /home/eantonov/.cache/pip/wheels/c8/7a/03/398f5b358e667909b85ca7e451b0e5aa7b58fd4250fbf37841
Building wheel for yarl (setup.py) ... done
Created wheel for yarl: filename=yarl-1.2.6-py3-none-any.whl size=83523 sha256=ecd13b6395fe7552a117f6c7dbe7f146decf10b8bc393e5de41ee16c1d445124
Stored in directory: /home/eantonov/.cache/pip/wheels/d8/9c/fd/20a1f954c7b8e0a1eb02bf92b5ca09d7cb8b1e58af091c00ee
Successfully built aiohttp asks contextvars immutables lazy-object-proxy multidict multio wrapt yarl
Failed to build typed-ast
Installing collected packages: wrapt, typed-ast, sortedcontainers, six, pycodestyle, mccabe, lazy-object-proxy, immutables, idna, h11, chardet, certifi, attrs, urllib3, tqdm, sniffio, py, pluggy, pathlib2, outcome, multio, multidict, more-itertools, isort, contextvars, atomicwrites, async-timeout, async-generator, astroid, yarl, trio, requests, pytest, asks, aiohttp
Running setup.py install for typed-ast ... error
error: subprocess-exited-with-error

× Running setup.py install for typed-ast did not run successfully.
│ exit code: 1
╰─> [250 lines of output]
running install
/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.10
creating build/lib.linux-x86_64-3.10/typed_ast
copying typed_ast/ast3.py -> build/lib.linux-x86_64-3.10/typed_ast
copying typed_ast/conversions.py -> build/lib.linux-x86_64-3.10/typed_ast
copying typed_ast/ast27.py -> build/lib.linux-x86_64-3.10/typed_ast
copying typed_ast/init.py -> build/lib.linux-x86_64-3.10/typed_ast
running build_ext
building '_ast27' extension
creating build/temp.linux-x86_64-3.10
creating build/temp.linux-x86_64-3.10/ast27
creating build/temp.linux-x86_64-3.10/ast27/Custom
creating build/temp.linux-x86_64-3.10/ast27/Parser
creating build/temp.linux-x86_64-3.10/ast27/Python
x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/usr/include/python3.10 -c ast27/Custom/typed_ast.c -o build/temp.linux-x86_64-3.10/ast27/Custom/typed_ast.o
In file included from ast27/Include/Python-ast.h:3,
from ast27/Custom/typed_ast.c:2:
ast27/Include/asdl.h:37:41: error: unknown type name ‘PyArena’
37 | asdl_seq *asdl_seq_new(Py_ssize_t size, PyArena *arena);
| ^~~~~~~
ast27/Include/asdl.h:38:49: error: unknown type name ‘PyArena’
38 | asdl_int_seq *asdl_int_seq_new(Py_ssize_t size, PyArena *arena);
| ^~~~~~~
In file included from ast27/Custom/typed_ast.c:2:
ast27/Include/Python-ast.h:397:63: error: unknown type name ‘PyArena’
397 | mod_ty _Ta27_Module(asdl_seq * body, asdl_seq * type_ignores, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:399:43: error: unknown type name ‘PyArena’
399 | mod_ty _Ta27_Interactive(asdl_seq * body, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:401:39: error: unknown type name ‘PyArena’
401 | mod_ty _Ta27_Expression(expr_ty body, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:403:65: error: unknown type name ‘PyArena’
403 | mod_ty _Ta27_FunctionType(asdl_seq * argtypes, expr_ty returns, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:405:37: error: unknown type name ‘PyArena’
405 | mod_ty _Ta27_Suite(asdl_seq * body, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:408:92: error: unknown type name ‘PyArena’
408 | decorator_list, string type_comment, int lineno, int col_offset, PyArena
| ^~~~~~~
ast27/Include/Python-ast.h:412:68: error: unknown type name ‘PyArena’
412 | decorator_list, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:414:65: error: unknown type name ‘PyArena’
414 | stmt_ty _Ta27_Return(expr_ty value, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:416:70: error: unknown type name ‘PyArena’
416 | stmt_ty _Ta27_Delete(asdl_seq * targets, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:419:34: error: unknown type name ‘PyArena’
419 | col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:422:25: error: unknown type name ‘PyArena’
422 | PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:424:91: error: unknown type name ‘PyArena’
424 | stmt_ty _Ta27_Print(expr_ty dest, asdl_seq * values, bool nl, int lineno, int col_offset, PyArena
| ^~~~~~~
ast27/Include/Python-ast.h:428:61: error: unknown type name ‘PyArena’
428 | type_comment, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:431:21: error: unknown type name ‘PyArena’
431 | PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:434:18: error: unknown type name ‘PyArena’
434 | PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:437:62: error: unknown type name ‘PyArena’
437 | type_comment, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:439:92: error: unknown type name ‘PyArena’
439 | stmt_ty _Ta27_Raise(expr_ty type, expr_ty inst, expr_ty tback, int lineno, int col_offset, PyArena
| ^~~~~~~
ast27/Include/Python-ast.h:443:37: error: unknown type name ‘PyArena’
443 | col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:445:93: error: unknown type name ‘PyArena’
445 | stmt_ty _Ta27_TryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno, int col_offset, PyArena
| ^~~~~~~
ast27/Include/Python-ast.h:448:77: error: unknown type name ‘PyArena’
448 | stmt_ty _Ta27_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:450:68: error: unknown type name ‘PyArena’
450 | stmt_ty _Ta27_Import(asdl_seq * names, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:453:38: error: unknown type name ‘PyArena’
453 | col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:456:20: error: unknown type name ‘PyArena’
456 | PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:458:68: error: unknown type name ‘PyArena’
458 | stmt_ty _Ta27_Global(asdl_seq * names, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:460:63: error: unknown type name ‘PyArena’
460 | stmt_ty _Ta27_Expr(expr_ty value, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:462:48: error: unknown type name ‘PyArena’
462 | stmt_ty _Ta27_Pass(int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:464:49: error: unknown type name ‘PyArena’
464 | stmt_ty _Ta27_Break(int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:466:52: error: unknown type name ‘PyArena’
466 | stmt_ty _Ta27_Continue(int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:468:83: error: unknown type name ‘PyArena’
468 | expr_ty _Ta27_BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:471:21: error: unknown type name ‘PyArena’
471 | PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:473:83: error: unknown type name ‘PyArena’
473 | expr_ty _Ta27_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:475:83: error: unknown type name ‘PyArena’
475 | expr_ty _Ta27_Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:477:93: error: unknown type name ‘PyArena’
477 | expr_ty _Ta27_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int col_offset, PyArena
| ^~~~~~~
ast27/Include/Python-ast.h:480:84: error: unknown type name ‘PyArena’
480 | expr_ty _Ta27_Dict(asdl_seq * keys, asdl_seq * values, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:482:64: error: unknown type name ‘PyArena’
482 | expr_ty _Ta27_Set(asdl_seq * elts, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:484:88: error: unknown type name ‘PyArena’
484 | expr_ty _Ta27_ListComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena
| ^~~~~~~
ast27/Include/Python-ast.h:487:87: error: unknown type name ‘PyArena’
487 | expr_ty _Ta27_SetComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena
| ^~~~~~~
ast27/Include/Python-ast.h:491:36: error: unknown type name ‘PyArena’
491 | col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:493:92: error: unknown type name ‘PyArena’
493 | expr_ty _Ta27_GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena
| ^~~~~~~
ast27/Include/Python-ast.h:496:64: error: unknown type name ‘PyArena’
496 | expr_ty _Ta27_Yield(expr_ty value, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:499:35: error: unknown type name ‘PyArena’
499 | col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:502:56: error: unknown type name ‘PyArena’
502 | kwargs, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:504:63: error: unknown type name ‘PyArena’
504 | expr_ty _Ta27_Repr(expr_ty value, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:506:57: error: unknown type name ‘PyArena’
506 | expr_ty _Ta27_Num(object n, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:508:68: error: unknown type name ‘PyArena’
508 | expr_ty _Ta27_Str(string s, int has_b, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:511:37: error: unknown type name ‘PyArena’
511 | col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:514:37: error: unknown type name ‘PyArena’
514 | col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:516:84: error: unknown type name ‘PyArena’
516 | expr_ty _Ta27_Name(identifier id, expr_context_ty ctx, int lineno, int col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:518:86: error: unknown type name ‘PyArena’
518 | expr_ty _Ta27_List(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena
| ^~~~~~~
ast27/Include/Python-ast.h:521:87: error: unknown type name ‘PyArena’
521 | expr_ty _Ta27_Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena
| ^~~~~~~
ast27/Include/Python-ast.h:524:25: error: unknown type name ‘PyArena’
524 | slice_ty _Ta27_Ellipsis(PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:526:66: error: unknown type name ‘PyArena’
526 | slice_ty _Ta27_Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:528:42: error: unknown type name ‘PyArena’
528 | slice_ty _Ta27_ExtSlice(asdl_seq * dims, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:530:37: error: unknown type name ‘PyArena’
530 | slice_ty _Ta27_Index(expr_ty value, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:532:84: error: unknown type name ‘PyArena’
532 | comprehension_ty _Ta27_comprehension(expr_ty target, expr_ty iter, asdl_seq * ifs, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:535:50: error: unknown type name ‘PyArena’
535 | col_offset, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:538:66: error: unknown type name ‘PyArena’
538 | defaults, asdl_seq * type_comments, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:540:57: error: unknown type name ‘PyArena’
540 | keyword_ty _Ta27_keyword(identifier arg, expr_ty value, PyArena *arena);
| ^~~~~~~
ast27/Include/Python-ast.h:542:58: error: unknown type name ‘PyArena’
542 | alias_ty _Ta27_alias(identifier name, identifier asname, PyArena arena);
| ^~~~~~~
ast27/Include/Python-ast.h:544:45: error: unknown type name ‘PyArena’
544 | type_ignore_ty _Ta27_TypeIgnore(int lineno, PyArena arena);
| ^~~~~~~
ast27/Include/Python-ast.h:547:39: error: unknown type name ‘PyArena’
547 | mod_ty Ta27AST_obj2mod(PyObject
ast, PyArena
arena, int mode);
| ^~~~~~~
In file included from ast27/Custom/typed_ast.c:7:
ast27/Include/ast.h:8:49: error: unknown type name ‘PyArena’
8 | const char *, PyArena *);
| ^~~~~~~
ast27/Custom/typed_ast.c:209:54: error: unknown type name ‘PyArena’
209 | PyCompilerFlags *flags, PyArena *arena)
| ^~~~~~~
ast27/Custom/typed_ast.c: In function ‘string_object_to_py_ast’:
ast27/Custom/typed_ast.c:243:5: error: unknown type name ‘PyArena’
243 | PyArena *arena = PyArena_New();
| ^~~~~~~
ast27/Custom/typed_ast.c:243:22: warning: implicit declaration of function ‘PyArena_New’; did you mean ‘PyGen_New’? [-Wimplicit-function-declaration]
243 | PyArena *arena = PyArena_New();
| ^~~~~~~~~~~
| PyGen_New
ast27/Custom/typed_ast.c:243:22: warning: initialization of ‘int *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
ast27/Custom/typed_ast.c:247:11: warning: implicit declaration of function ‘string_object_to_c_ast’; did you mean ‘string_object_to_py_ast’? [-Wimplicit-function-declaration]
247 | mod = string_object_to_c_ast(str, filename, start, flags, arena);
| ^~~~~~~~~~~~~~~~~~~~~~
| string_object_to_py_ast
ast27/Custom/typed_ast.c:247:9: warning: assignment to ‘mod_ty’ {aka ‘struct _mod *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
247 | mod = string_object_to_c_ast(str, filename, start, flags, arena);
| ^
ast27/Custom/typed_ast.c:249:9: warning: implicit declaration of function ‘PyArena_Free’; did you mean ‘PyMem_Free’? [-Wimplicit-function-declaration]
249 | PyArena_Free(arena);
| ^~~~~~~~~~~~
| PyMem_Free
At top level:
ast27/Custom/typed_ast.c:200:1: warning: ‘err_free’ defined but not used [-Wunused-function]
200 | err_free(perrdetail *err)
| ^~~~~~~~
ast27/Custom/typed_ast.c:80:1: warning: ‘err_input’ defined but not used [-Wunused-function]
80 | err_input(perrdetail *err)
| ^~~~~~~~~
ast27/Custom/typed_ast.c:65:12: warning: ‘PARSER_FLAGS’ defined but not used [-Wunused-function]
65 | static int PARSER_FLAGS(PyCompilerFlags *flags)
| ^~~~~~~~~~~~
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> typed-ast

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
(venv) eantonov@arrakis2:~/Documents/PYTHONDEV/exercices/REALPYTHON/concurrency-overview$

Socket with if-loops does not give a consistent result

The program is continuously receiving data from the sender side. And I have a checked/unchecked button when I make it checked it runs the if part...that's good. Now I make it unchecked then else part runs and prints Unchecked going to close socket, so that's also good.

The problem is when I am going to make it again checked (2nd time) to run if part again it just print Checked and my program hangs. Why is this happening? It should receive the data but it hangs. Please tell me the solution.

def show_markers(self):
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    host = socket.gethostbyname('192.168.225.12')
    s.connect((host, port))
    scale=0

    while True:

        if self.iconAction.isChecked():
            print ('Checked')
            m = QgsVertexMarker(self.iface.mapCanvas())
            data = s.recv(SIZE)
            data1 = s.recv(SIZE)
            c = data.decode()
            d = data1.decode()
            x = float(c)
            y = float(d)
            print("printing X :", x)
            print("printing Y :", y)
            rect = QgsRectangle(float(x)-scale, float(y)-scale, float(x)+scale, float(y)+scale)
            me = self.iface.mapCanvas()
            me.setExtent(rect)
            me.refresh()
            m.setCenter(QgsPointXY(x, y))
            m.setColor(QColor(255, 0, 0))
            m.setIconSize(7)
            m.setIconType(QgsVertexMarker.ICON_X)  # or ICON_CROSS, ICON_X
            m.setPenWidth(3)

        else:
            print('Unchecked going to close socket')
            s.shutdown(10)
            s.close()

I am assuming it should work like:

  1. 1st time click on button ---> Checked & if part run [working]
  2. 2nd time click on button ---> Unchecked & else part run [working]
  3. 3rd time click on button ---> again it Checked [here it checked but my program hangs & not receiving the data from sender computer]

Linux only tutorial fails to identify as such

This tutorial using this code only works on linux. Unfortunately I had to find out myself, since the tutorial doesn't really make it clear. To make this work with MSVC a lot needs to be changed, including all the compiling, the C/C++ source files, some of file path stuff and more. Even when using GCC most of the issues remain.

I suggest adding a big disclaimer that the tutorial is only for linux or even better, expanding it so that the rest of us can follow along too :(

@jima80525

multiconn-client.py sometimes concatenates messages

@dbader, thanks very much for your example code.

Description of the bug

Running the multi-connection example from the python-sockets-tutorial, ie,

  • materials/python-sockets-tutorial/multiconn-client.py

sometimes, but not always, concatenates the two messages.

To Reproduce

Start the server and view the output from when the client is run (see below)

python -u multiconn-server.py 127.0.0.1 65432

  listening on ('127.0.0.1', 65432)

  accepted connection from ('127.0.0.1', 50484)
  echoing b'Message 1 from client.' to ('127.0.0.1', 50484)
  echoing b'Message 2 from client.' to ('127.0.0.1', 50484)
  closing connection to ('127.0.0.1', 50484)

  accepted connection from ('127.0.0.1', 50486)
  echoing b'Message 1 from client.Message 2 from client.' to ('127.0.0.1', 50486)
  closing connection to ('127.0.0.1', 50486)

Run the client twice with 1 connection (see below). The first run gives expected results, the second run concatenates the two messages (as can be seen below). The concatenation is also evident in the output from multiconn-server.py above.

python -u multiconn-client.py 127.0.0.1 65432 1

  starting connection 1 to ('127.0.0.1', 65432)
  sending b'Message 1 from client.' to connection 1
  sending b'Message 2 from client.' to connection 1
  received b'Message 1 from client.' from connection 1
  received b'Message 2 from client.' from connection 1
  closing connection 1

python -u multiconn-client.py 127.0.0.1 65432 1

  starting connection 1 to ('127.0.0.1', 65432)
  sending b'Message 1 from client.' to connection 1
  sending b'Message 2 from client.' to connection 1
  received b'Message 1 from client.Message 2 from client.' from connection 1
  closing connection 1

Expected behavior

The output form the second run of the multiconn-client.py should be identical to the output from the first run.

Desktop (please complete the following information):

  • OS: CentOS 7
  • Browser: Firefox
  • Version 91.2.0esr (64-bit)

Additional context
Python 3.8.0

Flask-Google-login Error: Got unexpected extra argument (run)

Hello! I was working on adding this to one of my projects when I got an error, so I installed the example and got the same error:
Usage: flask [OPTIONS]
Try 'flask --help' for help.

Error: Got unexpected extra argument (run)

I found that when I removed @click.command("init-db") (Line 33, From db.py) that I didnt get the error anymore, Does anyone know what I can do to fix this?

My python version is 3.9.0

Sorry If this seems messy or incorrect (this is the first time I posted an issue)

State the Django and Python Version

Neither the article nor the README for this project states the version of Django that this project works on. I found a migration that said Generated by Django 2.1.4 on 2018-12-16 19:11.

So the article should state right up top: "This project works with Django 2.1.4 and may require modifications to work with later versions of Django." Same message for this project's README.

The current version of Django is 3.1, which means breaking changes have been introduced since the article was written more than 2 years ago.

sh script not running

ℹ️ Please note that the best way to get support for Real Python courses & articles is to join one of our weekly Office Hours calls or in the RP Community Slack.

You can report issues and problems here, but we typically won't be able to provide 1:1 support outside the channels listed above.

Describe the bug
$ ./build_and_run.sh
Generating a RSA private key
................................................................................
..........................................++++
................................................................................
.................++++
writing new private key to 'ca.key'

name is expected to be in the format /type0=value0/type1=value1/type2=... where
characters may be escaped by . This name is not in that format: 'C:/Program Fil
es/Git/O=me'
problems making Certificate Request
Generating a RSA private key
....................................................................++++
................................................................................
..........++++
writing new private key to 'client.key'

name is expected to be in the format /type0=value0/type1=value1/type2=... where
characters may be escaped by . This name is not in that format: 'C:/Program Fil
es/Git/CN=marketplace'
problems making Certificate Request
Generating a RSA private key
..........................................................++++
................................................................................
..............................................++++
writing new private key to 'server.key'

name is expected to be in the format /type0=value0/type1=value1/type2=... where
characters may be escaped by . This name is not in that format: 'C:/Program Fil
es/Git/CN=recommendations'
problems making Certificate Request
Can't open client.csr for reading, No such file or directory
19404:error:02001002:system library:fopen:No such file or directory:../openssl-1.1.1s/crypto/bio/bss_file.c:69:fopen('client.csr','r')
19404:error:2006D080:BIO routines:BIO_new_file:no such file:../openssl-1.1.1s/crypto/bio/bss_file.c:76:
Can't open server.csr for reading, No such file or directory
19660:error:02001002:system library:fopen:No such file or directory:../openssl-1.1.1s/crypto/bio/bss_file.c:69:fopen('server.csr','r')
19660:error:2006D080:BIO routines:BIO_new_file:no such file:../openssl-1.1.1s/crypto/bio/bss_file.c:76:

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
image

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Basic Question

I am still learning the nuances of Python and going through the tutorial 'python-bindings-overview' but I am having difficult getting to to work for me. I am running Ubuntu 18.04. I noted the tutorial said to install invoke so I followed the example provided in the article (python3 -m pip install invoke) to install. But when I ran it, it crashes. I worked through a discovered that you also had to install CFFI and PATHLIB (pyton3 -m pip install cffi pathlib) to get invoke to work and not crash. Now, after installing those packages, I can get the --list command to list all
image
but when I try and execute the 'invoke build-cmult' or 'invoke all' or 'invoke clean' is says:
image

Any ideas or suggestions why this is happening and what I can do to resolve it?

Django Diary "TemplateDoesNotExist"

Hello,

I just finished up to the end of step 3 in the Django Diary tutorial, but the web application is still throwing the following error:

TemplateDoesNotExist at /
entries/entry_list.html

I've double and triple checked that all my code is correct and all the files are in the proper directory, but at this point I'm at a loss. Screenshot of the error below. Any help would be massively appreciated.

image

hi There, upon running the codes below, i have the problem in the last 2 lines : sock.sendto(message.format(i, time.asctime()), server_address) TypeError: a bytes-like object is required, not 'str'

Import Module

import socket
import time

Create a TCP/IP socket

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

Connect the socket to the port where the server is listening

server_address = ("localhost", 10000)

print('[+] Connecting to %s Port %s' % server_address)

message="Message No. {} | Sent By Client At Time {} "

for i in range(15):
sock.sendto(message.format(i, time.asctime()), server_address)

flask-google-login: login_user fails to set sessions cookie

I am using this code by splitting it into a separate blueprint and using the application factory method. I am able to get to the user's data from Google and it reflects the in the db as well, but the login_user function fails with the following error –

Traceback (most recent call last):
  File "/home/user/otpd/venv/lib/python3.6/site-packages/flask/app.py", line 1969, in finalize_request
    response = self.process_response(response)
  File "/home/user/otpd/venv/lib/python3.6/site-packages/flask/app.py", line 2268, in process_response
    self.session_interface.save_session(self, ctx.session, response)
  File "/home/user/otpd/venv/lib/python3.6/site-packages/flask/sessions.py", line 387, in save_session
    samesite=samesite,
  File "/home/user/otpd/venv/lib/python3.6/site-packages/werkzeug/wrappers/base_response.py", line 481, in set_cookie
    samesite=samesite,
  File "/home/user/otpd/venv/lib/python3.6/site-packages/werkzeug/http.py", line 1163, in dump_cookie
    buf = [key + b"=" + _cookie_quote(value)]
TypeError: unsupported operand type(s) for +: 'NoneType' and 'bytes'

I am unable to figure out what the reason could be. Any suggestions?

If it helps - I am deploying this code on a remote server using Gunicorn.

Thanks!

textcat -> architecture extra fields not permitted

Good evening sir,

I've been trying to practise what I've learned from your tutorial:(https://realpython.com/sentiment-analysis-python/) using PyCharm.

And these lines:
textcat.add_label("pos")
textcat.add_label("neg")

generated a warning ==>
#Cannot find reference 'add_label' in '(Doc) -> Doc | (Doc) -> Doc'

I thought it maybe because of a difference between my spacy version and yours, so I run the script anyway, but then I got the an error from this line==>

textcat = nlp.create_pipe("textcat", config={"architecture": "simple_cnn"})

Error msg:
raise ConfigValidationError(
thinc.config.ConfigValidationError:

Config validation error

textcat -> architecture extra fields not permitted

{'nlp': <spacy.lang.en.English object at 0x0000015E74F625E0>, 'name': 'textcat', 'architecture': 'simple_cnn', 'model': {'@architectures': 'spacy.TextCatEnsemble.v2', 'linear_model': {'@architectures': 'spacy.TextCatBOW.v1', 'exclusive_classes': True, 'ngram_size': 1, 'no_output_layer': False}, 'tok2vec': {'@architectures': 'spacy.Tok2Vec.v2', 'embed': {'@architectures': 'spacy.MultiHashEmbed.v1', 'width': 64, 'rows': [2000, 2000, 1000, 1000, 1000, 1000], 'attrs': ['ORTH', 'LOWER', 'PREFIX', 'SUFFIX', 'SHAPE', 'ID'], 'include_static_vectors': False}, 'encode': {'@architectures': 'spacy.MaxoutWindowEncoder.v2', 'width': 64, 'window_size': 1, 'maxout_pieces': 3, 'depth': 2}}}, 'threshold': 0.5, '@factories': 'textcat'}

I'm very new to spacy and data analysis over all, so please excuse me if it's a stupid mistake from my side.

Thank you

PyCalc Tutorial: ModuleNotFoundError: No module named 'PyQt5'

I keep getting an import error on import. I've copied and pasted the code from this repo and the same error shows. I've also checked out the PyQt library and can't seem to get this to work. I am a beginner.

Here is the error msg from my command line:
G:\Projects\calculator> python .\pycalc.py
Traceback (most recent call last):
File ".\pycalc.py", line 10, in
from PyQt5.QtCore import Qt
ModuleNotFoundError: No module named 'PyQt5'

OS: Windows 10
CMD: PowerShell

No module named 'pybind11_example'

Hello,

I think this is an easy error but I can't solve it.
When i run invoke test-pybind11 I obtain

You indicated pty=True, but your platform doesn't support the 'pty' module!

I change this to pty = sys.platform != 'win32' but I obtain
No module named 'pybind11_example'

Thank you for your help,

Florent

Error while creating sample Dash application

Hi Team,
I have created the sample app.py script. When I run the script I am getting below error. I have executed all the previous commands correctly. Not sure what went wrong. Please help.

Traceback (most recent call last):
File "D:\avocado_analytics\venv\app.py", line 1, in
import dash
ModuleNotFoundError: No module named 'dash'

requirements.txt includes "pkg-resources==0.0.0"

This is for the concurrency-overview folder. (Editing because I realized there are many other tutorials in this repository.)

concurrency-overview/requirements.txt includes the line "pkg-resources==0.0.0", which causes pip install -r .\requirements.txt to fail with: Could not find a version that satisfies the requirement pkg-resources==0.0.0 (from -r .\requirements.txt (line 23)) (from versions: ) No matching distribution found for pkg-resources==0.0.0 (from -r .\requirements.txt (line 23))

This is on Windows 10 with Python 3.6.4. This question on StackOverflow looks to be the same issue: https://stackoverflow.com/questions/39577984/what-is-pkg-resources-0-0-0-in-output-of-pip-freeze-command

Removing the line "pkg-resources==0.0.0" from requirements.txt fixes the issue.

problem with index.html

ss1----this is what is actually showing me
There is a problem with the index.html file. I'm trying to reach the resulting webpage that is present in the repository, and I copied every line of code right, but somehow it isn't working. Any solutions?
ss

Monster.com has Changed to Dynamically Generated

ℹ️ https://www.monster.com/jobs/search/?q=python&where=chicago%2C-IL&stpage=1&page=3
If you look at the source code, you can see they're using JS to generate the pages.

You can report issues and problems here, but we typically won't be able to provide 1:1 support outside the channels listed above.

Describe the bug
This tutorial no longer works with Monster due to change in how pages are generated.

To Reproduce
Steps to reproduce the behavior:

  1. Go to link above to see
  2. Run code on site to see error
  3. Confirm it exits with an error due to objects no longer existing

Expected behavior
For the script to compile without errors.

Desktop (please complete the following information):

  • OS: Mint
  • Browser: FF
  • Version : 87

Mac Mojave and Python 3.8 working branch

Hi, I have a branch to push to you with a working version of the python binding module
with Mac Mojave and Python 3.8 using python.org version of python, (not brew)

Cheers Dave.

Notes here;

help on python c binding

dependencies

install python3.8 from python.org

pip3 install pybind11
pip3 install invoke
pip3 install Cython

security block

mac mojave blocks relative pathed libraries, here is the fix

install_name_tool

def install_name_tool(dependent=None, depends=[]):
    '''
    make the lib full path to get around security blocking relative paths
    '''
    for dependson in depends:
        full_path = os.path.abspath(dependson)
        shell_str='install_name_tool -change {0} {1} {2}'.format(dependson, full_path, dependent)
        print('    install_name_tool: {0}'.format(dependson))
        invoke.run(shell_str)

mac G++ missing symbols

mac compile gets upset about missing symbols

ignore missing symbols on a mac

On Mac OS: the build command is almost the same but it also requires passing the -undefined dynamic_lookup flag so as to ignore missing symbols when building the module:

in task.py

def compile_python_module(cpp_name, extension_name):
    invoke.run(
        "g++ -O3 -Wall -Werror -shared -std=c++11 -fPIC "
        "`python3.8-config --includes` "
        "`python3 -m pybind11 --includes` "
        "-undefined dynamic_lookup "
        "-I . "
        "{0} "
        "-o {1}`python3.8-config --extension-suffix` "
        "-L. -lcppmult -Wl,-rpath,.".format(cpp_name, extension_name)
    )

compile and test

here is the output from a good compile and test run

$ invoke all
==================================================
= Building C Library 
* Complete
==================================================
= Testing ctypes Module 
    In cmult : int: 6 float 2.3 returning  13.8
    In Python: int: 6 float 2.3 return val 48.0

    In cmult : int: 6 float 2.3 returning  13.8
    In Python: int: 6 float 2.3 return val 13.8
==================================================
= Building CFFI Module 
    install_name_tool: libcmult.so
* Complete
==================================================
= Testing CFFI Module 
    In cmult : int: 6 float 2.3 returning  13.8
    In Python: int: 6 float 2.3 return val 13.8
==================================================
= Building C++ Library 
    install_name_tool: libcmult.so
    install_name_tool: cffi_example.cpython-38-darwin.so
* Complete
==================================================
= Building PyBind11 Module 
    install_name_tool: libcmult.so
    install_name_tool: cffi_example.cpython-38-darwin.so
    install_name_tool: libcppmult.so
* Complete
==================================================
= Testing PyBind11 Module 
    In cppmul: int: 6 float 2.3 returning  13.8
    In Python: int: 6 float 2.3 return val 13.8
==================================================
= Building Cython Module 
    install_name_tool: libcmult.so
    install_name_tool: cffi_example.cpython-38-darwin.so
    install_name_tool: libcppmult.so
* Complete
==================================================
= Testing Cython Module 
    In cppmul: int: 6 float 2.3 returning  13.8
    In Python: int: 6 float 2.3 return val 13.8

Cannot resolve keyword 'post' into field. Choices are: author, body, created_on, id, posts,

Request Method: GET
http://127.0.0.1:8000/blog/5/
2.2.1
FieldError
Cannot resolve keyword 'post' into field. Choices are: author, body, created_on, id, posts, posts_id
C:\Users\UPosia\Anaconda3\envs\conjango\lib\site-packages\django\db\models\sql\query.py in names_to_path, line 1420
C:\Users\UPosia\Anaconda3\envs\conjango\python.exe
3.7.3
['F:\My_Django\personal_portfolio\src', 'C:\Users\UPosia\Anaconda3\envs\conjango\python37.zip', 'C:\Users\UPosia\Anaconda3\envs\conjango\DLLs', 'C:\Users\UPosia\Anaconda3\envs\conjango\lib', 'C:\Users\UPosia\Anaconda3\envs\conjango', 'C:\Users\UPosia\Anaconda3\envs\conjango\lib\site-packages']
Thu, 8 Aug 2019 19:03:40 +0000

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.