python-3.7

pathlib Path resolves installed path directory of package instead of source code directory

╄→гoц情女王★ 提交于 2019-12-11 07:34:31
问题 I have packaged my project using setup.py and project folder structure looks like below. api-automation api packagename __init__.py user.py payloads a.json b.json tests conftest.py setup.cfg setup.py README.rst I have created virtual environment in below folder with name "myenv_1", /Users/basavarajlamani/Documents/environments/ and i have installed above repo in this virtual environment. I tried a lot on stackoverflow and internet but did not found answer. code of user.py file from pathlib

Python 3.7 cmath module import error

╄→гoц情女王★ 提交于 2019-12-11 06:49:57
问题 i installed python3.7 on ubuntu using ppa:deadsnakes/ppa repository. When I try to run import cmath in python shell it fails with message: ModuleNotFoundError: No module named 'cmath' I didn't find any info about depracation of this library or anything in python3.7 changelog. It works fine in pythons 3.5 and 2.7. I tried installing it on different ubuntu virtual machines and computers and I always get the same result. Do I need to install some specific library or something (which I doubt

Pyinstaller missing bootloader

怎甘沉沦 提交于 2019-12-11 06:34:44
问题 I fresh installed Python37-32 on win10-64 All requirements seem to be satisfied and my hello world python file is executing if __name__ == '__main__' : print("hello world") However when I try to use pyinstaller pyinstaller hello.py It finishes with error 5764 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully. 5764 INFO: Bootloader c:\users\xxxxxxx\appdata\local\programs\python\python37-32\lib\site-packages\PyInstaller\bootloader\Windows-32bit\run_d.exe 5764 INFO: checking EXE

Is the a way of getting the degree of positiveness or negativeness when using Logistic Regression for sentiment analysis

你说的曾经没有我的故事 提交于 2019-12-11 06:17:22
问题 I have been following an example about Sentiment Analysis using Logistic Regression, in which prediction result only gives a 1 or 0 to give positive or negative sentiment respectively. My challenge is that i want to classify a given user input into one of the four classes (very good, good, average, poor) but my prediction result every time is 1 or 0. Below is my code sample so far from sklearn.feature_extraction.text import CountVectorizer from vaderSentiment.vaderSentiment import

Converting concurrent futures to Asyncio python3.7

人走茶凉 提交于 2019-12-11 06:15:30
问题 I am going to start looking at converting my code use asyncio. I cant find an example or explanation that I understand. I was wondering if someone could convert this simple code to use asyncio rather than concurrent futures? This was some old code that helped my understand how threading could help with speeding things up. import time from concurrent import futures def run(data): time.sleep(.5) print("Hello World") return data = range(20) max_workers = 10 concurrent = futures

asyncio.run fails when loop.run_until_complete works

随声附和 提交于 2019-12-11 06:05:46
问题 This code fails: import asyncio from motor import motor_asyncio _client = motor_asyncio.AsyncIOMotorClient() _db = _client.db users = _db.users async def main(): await users.create_index( 'login', unique=True ) if __name__ == '__main__': #loop = asyncio.get_event_loop() #loop.run_until_complete(main()) asyncio.run(main()) With this error: Traceback (most recent call last): File "/home/sanyash/myrepos/TKP/db.py", line 21, in <module> asyncio.run(main()) File "/usr/local/lib/python3.7/asyncio

python3 dataclass with **kwargs(asterisk)

断了今生、忘了曾经 提交于 2019-12-11 05:13:34
问题 Currently I used DTO(Data Transfer Object) like this. class Test1: def __init__(self, user_id: int = None, body: str = None): self.user_id = user_id self.body = body Example code is very small, But when object scale growing up, I have to define every variable. While digging into it, found that python 3.7 supported dataclass Below code is DTO used dataclass. from dataclasses import dataclass @dataclass class Test2: user_id: int body: str In this case, How can I allow pass more argument that

TypeError: Object of type TextIOWrapper is not JSON serializable

夙愿已清 提交于 2019-12-11 00:46:39
问题 If the code was to work properly then whenever someone types something in the chat they get 5 experience and that information gets put into a .json file, but instead what happens is whenever someone types something into the chat it gives me this error. on_message users = json.dumps(f) TypeError: Object of type TextIOWrapper is not JSON serializable Here is the code that I am using: import discord from discord.ext import commands from discord.ext.commands import Bot import asyncio import json

Cartopy examples produce a Segmentation fault

末鹿安然 提交于 2019-12-10 18:22:13
问题 Cartopy can't draw virtually anything. Even a simple example results in a segfault. Segmentation fault is all Python 3.7.0 says before crashing. So does Python 3.6.6 . The faulty line appear to be ax.coastlines() . ax.gridlines() gives the same silent segfault as well. matplotlib is 2.2.3 . Cartopy is the most recent by the date, 0.16.0 , installed with pip . All the requirements ( six , pyshp , setuptools , shapely , numpy ) are met. Reinstalling with pip doesn't help. Installing the same

Installing Twisted for Python using pip: error: Microsoft Visual Studio failed with exit status 2

北慕城南 提交于 2019-12-10 17:20:29
问题 When I try to install the python package Twisted on my windows 10 machine running python3.7, I'm unable to build a Wheel from the .tarz file and I eventually get the following output: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.14.26428\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DWIN32=1 -Ic:\users\dario\appdata\local\programs\python\python37-32\include -Ic:\users\dario\appdata\local\programs\python\python37-32\include "-IC:\Program Files