python-3.6

Pip error, OSError Errno 22 invalid argument

廉价感情. 提交于 2021-02-07 09:15:40
问题 When searching for or install packages with pip, I get the following error: pip3 search validate Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(22, 'Invalid argument'))': /pypi Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(22, 'Invalid argument'))': /pypi Retrying (Retry(total=2, connect=None, read=None,

Pip error, OSError Errno 22 invalid argument

被刻印的时光 ゝ 提交于 2021-02-07 09:15:20
问题 When searching for or install packages with pip, I get the following error: pip3 search validate Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(22, 'Invalid argument'))': /pypi Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(22, 'Invalid argument'))': /pypi Retrying (Retry(total=2, connect=None, read=None,

Iterate and extract tables from web saving as excel file in Python

╄→尐↘猪︶ㄣ 提交于 2021-02-05 11:30:12
问题 I want to iterate and extract table from the link here, then save as excel file. How can I do that? Thank you. My code so far: import pandas as pd import requests from bs4 import BeautifulSoup from tabulate import tabulate url = 'http://zjj.sz.gov.cn/ztfw/gcjs/xmxx/jgysba/' res = requests.get(url) soup = BeautifulSoup(res.content,'lxml') print(soup) New update: from requests import post import json import pandas as pd import numpy as np headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0;

Getting javascript variable value while scraping with python

。_饼干妹妹 提交于 2021-02-05 08:19:07
问题 I know this is asked before also, but I am a newbie in scraping and python. Please help me and it would be very much helpful in my learning path. I am scraping a news site using python with packages such as Beautiful Soup and etc. I am facing difficulty while getting the value of java script variable which is declared in script tag and also it is getting updated there. Here is the part of HTML page which I am scraping:(containing only script part) <!-- Eliminate render-blocking JavaScript and

Getting javascript variable value while scraping with python

旧城冷巷雨未停 提交于 2021-02-05 08:18:52
问题 I know this is asked before also, but I am a newbie in scraping and python. Please help me and it would be very much helpful in my learning path. I am scraping a news site using python with packages such as Beautiful Soup and etc. I am facing difficulty while getting the value of java script variable which is declared in script tag and also it is getting updated there. Here is the part of HTML page which I am scraping:(containing only script part) <!-- Eliminate render-blocking JavaScript and

Moving a Sprite in the direction of an angle in Pygame [duplicate]

*爱你&永不变心* 提交于 2021-02-05 07:25:06
问题 This question already has answers here : How to turn the sprite in pygame while moving with the keys (1 answer) Image rotation while moving (2 answers) Closed 23 days ago . Im trying to move a sprite in the direction of an angle in pygame, using the left & right arrow keys to change the direction of the sprite but when I press the up key, the sprite just moves right. I have 2 variables that take speed and a velocity calculation and adds them together (vel_x & vel_y), I then add this to the

How to use .loc to set as other column values in pandas

╄→гoц情女王★ 提交于 2021-02-05 07:15:06
问题 For example, I have a dataframe: cond value1 value2 0 True 1 1 1 False 3 5 2 True 34 2 3 True 23 23 4 False 4 2 I hope to replace value1 to value2*2 when cond=True . So I want the result is: cond value1 value2 0 True 2 1 1 False 3 5 2 True 4 2 3 True 46 23 4 False 4 2 I can achieve it by follow code: def convert(x): if x.cond: x.value1= x.value2*2 return x data = data.apply(lambda x: convert(x),axis=1) I think it is so slow when data is big. I try it by .loc , but I don't know how to set

f-string python invalid sysntax

可紊 提交于 2021-02-04 21:38:56
问题 I recently trying to learn to code in python and I have zero knowledge in any programming languages our there and I encounter this problem in it, in which I am trying to use the f-string function. My Python version is 3.6.2 and here's the code that I am trying to run greeting = 'Hello' name = 'John' message = f'{greeting} {name}. Welcome!' print(message) and here's the error it shows me. File "/Users/RQ/Desktop/intro.py", line 16 message = f'{greeting} {name}. Welcome!' ^ SyntaxError: invalid

How to find ideal number of parallel processes to run with python multiprocessing?

╄→гoц情女王★ 提交于 2021-02-04 21:36:50
问题 Trying to find out the correct number of parallel processes to run with python multiprocessing. Scripts below are run on an 8-core, 32 GB (Ubuntu 18.04) machine. (There were only system processes and basic user processes running while the below was tested.) Tested multiprocessing.Pool and apply_async with the following: from multiprocessing import current_process, Pool, cpu_count from datetime import datetime import time num_processes = 1 # vary this print(f"Starting at {datetime.now()}")

unable to open a connection with a FTD 232 device

て烟熏妆下的殇ゞ 提交于 2021-01-29 22:34:01
问题 I am trying to open a connection and pass a value for a given channel In order to do this I need to open a connection to the enttec open dmx usb. But I am unable to create a connection I tried to list devices and make sure the SN matches with the HW In [34]: import ftd2xx as ft In [35]: ft.listDevices() Out[35]: [b'AL05J8AO'] In [36]: ftd2xx.openEx('AL05J8AO', ftd2xx.ftd2xx.OPEN_BY_SERIAL_NUMBER) --------------------------------------------------------------------------- DeviceError Traceback