python-3.x

Getting error while trying to run this command “ pipenv install requests ” in mac OS

こ雲淡風輕ζ 提交于 2021-02-17 13:12:28
问题 I am facing the following error: Warning: the environment variable LANG is not set! We recommend setting this in ~/.profile (or equivalent) for proper expected behavior. Creating a virtualenv for this project… Using /usr/local/opt/python/bin/python3.6 (3.6.4) to create virtualenv… ⠋Traceback (most recent call last): File "/usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/local

Getting error while trying to run this command “ pipenv install requests ” in mac OS

喜欢而已 提交于 2021-02-17 13:11:39
问题 I am facing the following error: Warning: the environment variable LANG is not set! We recommend setting this in ~/.profile (or equivalent) for proper expected behavior. Creating a virtualenv for this project… Using /usr/local/opt/python/bin/python3.6 (3.6.4) to create virtualenv… ⠋Traceback (most recent call last): File "/usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/local

Invalid Syntax error when running python from inside Visual Studio Code

微笑、不失礼 提交于 2021-02-17 12:34:29
问题 i have a python file with the following content saved on my machine: types_of_people = 10 x = f"There are {types_of_people} types of people" binary = "binary" do_not = "don't" y = f"Those who know {binary} and those who {do_not}." print(x) print(y) print(f"i said: {x}") print(f"I also said: '{y}'") hilarious = False joke_evaluation = "Isn't that joke so funny?! {}" print(joke_evaluation.format(hilarious)) w = "This is the left side of ..." e = "a string with a right side." print(w + e) When i

Get column name based on condition in pandas

[亡魂溺海] 提交于 2021-02-17 07:18:07
问题 I have a dataframe as below: I want to get the name of the column if column of a particular row if it contains 1 in the that column. e.g. For Row 1: Blanks, For Row 2: Manufacturing, For Row 3: Manufacturing, For Row 4: Manufacturing, For Row 5: Social, Finance, Analytics, Advertising, Right now I am able to get the complete row only: primary_sectors = lambda primary_sector: sectors[ sectors["category_list"] == primary_sector ] Please help me to get the name of the column in the above

convert list to a particular json in python

此生再无相见时 提交于 2021-02-17 07:15:09
问题 I am working on a problem and my output is something like this: List with long string inside it ["21:15-21:30 IllegalAgrumentsException 1, 21:15-21:30 NullPointerException 2, 22:00-22:15 UserNotFoundException 1, 22:15-22:30 NullPointerException 1 ....."] I need to convert the data in something like this: response: [ { "time": "21:15-21:30", "logs": [ { "exception": "IllegalAgrumentsException", "count": 1 },{ "exception": "NullPointerException", "count": 2 } ] }, { "time": "22:00-22:15", "logs

ModuleNotFoundError and ImportError even beeing right

喜你入骨 提交于 2021-02-17 07:10:45
问题 Hello, thanks for your time. i'm trying to import models on seeders.py. Can someone please tell me what am i doing wrong, i've done this a hundred times and tried every single way: from winners.models import Player or from ..models import Player models.py: from django.db import models class Player (models.Model): name = models.CharField(max_length=100) sex = models.CharField(max_length=9, choices=sex_choices) age = models.PositiveIntegerField() height = models.DecimalField(max_digits=3,

Python class NameError. Var is not defined [duplicate]

左心房为你撑大大i 提交于 2021-02-17 07:10:43
问题 This question already has answers here : Short description of the scoping rules? (9 answers) How can I access “static” class variables within class methods in Python? (6 answers) Closed 3 years ago . class Gui(): var = None def refreshStats(args): print(str(var)) clas = Gui() clas.refreshStats() Trace File "sample.py", line 5, in refreshStats print(str(var)) NameError: name 'var' is not defined. Why? 回答1: If you want your variables to be visible within the scope of your class functions, pass

python add users input to an empty list using a for loop

回眸只為那壹抹淺笑 提交于 2021-02-17 07:10:12
问题 so I want to add users input to an empty list using this code no_of_num=int(input('enter the number of numbers you would like to add\n='))#this will store the number of numbers to be added list_of_num=[]#this list will store the number to be added for i in range(0,no_of_num):#we will ask them for the input num=int(input('enter the number\n=')) list_of_num.append(num)#this will keep adding the numbers to the list result=sum_of_num(num) but when I try running this code it just add the last

ModuleNotFoundError and ImportError even beeing right

六眼飞鱼酱① 提交于 2021-02-17 07:09:41
问题 Hello, thanks for your time. i'm trying to import models on seeders.py. Can someone please tell me what am i doing wrong, i've done this a hundred times and tried every single way: from winners.models import Player or from ..models import Player models.py: from django.db import models class Player (models.Model): name = models.CharField(max_length=100) sex = models.CharField(max_length=9, choices=sex_choices) age = models.PositiveIntegerField() height = models.DecimalField(max_digits=3,

CrawlerRunner not crawl pages with Crochet

。_饼干妹妹 提交于 2021-02-17 07:04:07
问题 I am trying to launch a Scrapy from script with CrawlerRunner() to launch in AWS Lambda. I watched in Stackoverflow the solution with crochet library, but it doesn´t work for me. Links: StackOverflow 1 StackOverflow 2 This is the code: import scrapy from scrapy.crawler import CrawlerRunner from scrapy.utils.project import get_project_settings from scrapy.utils.log import configure_logging # From response in Stackoverflow: https://stackoverflow.com/questions/41495052/scrapy-reactor-not