python-3.x

Pyplot either freezes or does not show in interactive mode

≡放荡痞女 提交于 2021-02-11 16:59:15
问题 I am making a script that fetches data every minute and then tries to show that in a matplotlib pyplot. I have three main files: control_cycle.py to control the loop and interact with other functions, api_connect.py(ac) to communicate with server and fetch data and graph_stock.py (gs) with a function to graph the data. So it is important that all time control and waiting is controller by control_cycle.py. However I just can't get the plotting to function properly. I have tried over a dozen

Call python scripts with many dependent libraries from C# code

拜拜、爱过 提交于 2021-02-11 16:58:45
问题 We have a C# module that needs to pass XML as a string to a python module and get the process result from that python module (has complicated logic and many imported libraries). But somehow I got nothing returned after several tries, the following is my sample code. Also is that possible to use pyinstaller to package the python module into EXE and achieve same functionality? public InquiryResponse ProcessXML(string xml) { ProcessStartInfo psi = new ProcessStartInfo(); psi.FileName = @"C:

Pyplot either freezes or does not show in interactive mode

痞子三分冷 提交于 2021-02-11 16:58:44
问题 I am making a script that fetches data every minute and then tries to show that in a matplotlib pyplot. I have three main files: control_cycle.py to control the loop and interact with other functions, api_connect.py(ac) to communicate with server and fetch data and graph_stock.py (gs) with a function to graph the data. So it is important that all time control and waiting is controller by control_cycle.py. However I just can't get the plotting to function properly. I have tried over a dozen

Adding image generated from another library as inset in matplotlib

梦想与她 提交于 2021-02-11 16:52:23
问题 I've generated a network figure using vedo library and I'm trying to add this as an inset to a figure generated in matplotlib import networkx as nx import matplotlib.pyplot as plt from vedo import * from matplotlib.offsetbox import OffsetImage, AnnotationBbox G = nx.gnm_random_graph(n=10, m=15, seed=1) nxpos = nx.spring_layout(G, dim=3, seed=1) nxpts = [nxpos[pt] for pt in sorted(nxpos)] nx_lines = [(nxpts[i], nxpts[j]) for i, j in G.edges()] pts = Points(nxpts, r=12) edg = Lines(nx_lines).lw

Getting error about ImageMagick With Python/MoviePy when I try add text clip

Deadly 提交于 2021-02-11 16:51:38
问题 I am using python 3.8.5 as well as the latest version of imagemagick and moviepy error (vs code): Traceback (most recent call last): File "C:\Users\edgib102\AppData\Local\Programs\Python\Python38-32\lib\site-packages\moviepy\video\VideoClip.py", line 1137, in __init__ subprocess_call(cmd, logger=None) File "C:\Users\edgib102\AppData\Local\Programs\Python\Python38-32\lib\site-packages\moviepy\tools.py", line 46, in subprocess_call proc = sp.Popen(cmd, **popen_params) File "C:\Users\edgib102

Getting error about ImageMagick With Python/MoviePy when I try add text clip

混江龙づ霸主 提交于 2021-02-11 16:51:34
问题 I am using python 3.8.5 as well as the latest version of imagemagick and moviepy error (vs code): Traceback (most recent call last): File "C:\Users\edgib102\AppData\Local\Programs\Python\Python38-32\lib\site-packages\moviepy\video\VideoClip.py", line 1137, in __init__ subprocess_call(cmd, logger=None) File "C:\Users\edgib102\AppData\Local\Programs\Python\Python38-32\lib\site-packages\moviepy\tools.py", line 46, in subprocess_call proc = sp.Popen(cmd, **popen_params) File "C:\Users\edgib102

Adding image generated from another library as inset in matplotlib

微笑、不失礼 提交于 2021-02-11 16:50:04
问题 I've generated a network figure using vedo library and I'm trying to add this as an inset to a figure generated in matplotlib import networkx as nx import matplotlib.pyplot as plt from vedo import * from matplotlib.offsetbox import OffsetImage, AnnotationBbox G = nx.gnm_random_graph(n=10, m=15, seed=1) nxpos = nx.spring_layout(G, dim=3, seed=1) nxpts = [nxpos[pt] for pt in sorted(nxpos)] nx_lines = [(nxpts[i], nxpts[j]) for i, j in G.edges()] pts = Points(nxpts, r=12) edg = Lines(nx_lines).lw

Entropy estimation from discrete variable

青春壹個敷衍的年華 提交于 2021-02-11 16:46:52
问题 I am trying to estimate conditional entropy of 3 variables using pyitlib package for python. But i am encountering error My code: import numpy as np from pyitlib import discrete_random_variable as drv X=[0,1,1,0,1,0,1,0,0,1,0,0] Y=[0,1,1,0,0,0,1,0,0,1,1,0] Z=[1,0,0,1,1,0,0,1,1,0,0,1] a=drv.entropy_conditional('X','Y','Z') print(a) The error: Warning (from warnings module): File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\lib\arraysetops.py", line 518 mask &=

AttributeError: ResultSet object has no attribute 'get_text'. You're probably treating a list of elements like a single element

删除回忆录丶 提交于 2021-02-11 16:41:30
问题 I got the following list of lists from parsing with Bs4 through the snippet: details = [i.find_all('span', {'class':re.compile('item')}) for i in cars] [[<span class="item">Red <small>col.</small></span>, <span class="item">120 <small>cc.</small></span>, <span class="item">Available <small>in four days</small></span>, <span class="item"><small class="txt-highlight-red">15 min</small></span>], [<span class="item">Blue <small>col.</small></span>, <span class="item">200 <small>cc.</small></span>

Discord Bot doesn't join voice channel

倾然丶 夕夏残阳落幕 提交于 2021-02-11 16:28:19
问题 im struggling to making my bot get into a voice channel, i have already read alot of posts that are here and none of them has been able to solve my problem, im trying to get my bot to reproduce the voice of a yt video but it doesn't even join and i dont know what to do, here is the code: import os import discord import youtube_dl from random import random, choice, randint from dotenv import load_dotenv from discord.ext import commands load_dotenv() token = os.getenv("DISCORD_TOKEN") GUILD =