python-3.5

No command runs in Subprocess [closed]

▼魔方 西西 提交于 2019-12-13 09:04:16
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 days ago . I have used a subprocess to convert Docx file to Pdf file in Django. On the server when I run the project with python manage.py runserver command. All things working file but if I run the application with Gunicorn my subprocess not work. Simple "ls" command is also not working. My server has ubuntu 18.04. I knew

How to compare output of wordnet.synsets?

怎甘沉沦 提交于 2019-12-13 07:15:51
问题 I want compare output from the wordnet.synset function in the NLTK library. In an example when I run: from nltk.corpus import wordnet as wn wn.synsets('dog') I get output: output: [Synset('dog.n.01'), Synset('frump.n.01'), Synset('dog.n.03'), Synset('cad.n.01'), Synset('frank.n.02'), Synset('pawl.n.01'), Synset('andiron.n.01'), Synset('chase.v.01')] Now if I try: from nltk.corpus import wordnet as wn wn.synsets('dogg') I get output output: [] How can I compare the outputs in the console to

python pandas merging excel sheets not working

萝らか妹 提交于 2019-12-13 07:00:29
问题 I'm trying to merge two excel sheets using the common filed Serial but throwing some errors. My program is as below : (user1_env)root@ubuntu:~/user1/test/compare_files# cat compare.py import pandas as pd source1_df = pd.read_excel('a.xlsx', sheetname='source1') source2_df = pd.read_excel('a.xlsx', sheetname='source2') joined_df = source1_df.join(source2_df, on='Serial') joined_df.to_excel('/root/user1/test/compare_files/result.xlsx') getting error as below : (user1_env)root@ubuntu:~/user1

Python OpenCV : VideoCapture differences between Python 2.7 to Python 3.5

亡梦爱人 提交于 2019-12-13 06:38:29
问题 I'm connected to remote system through ssh, and trying to read frames using OpenCV VideoCapture in Python. The same code succeeds when using Python 2.7 and fails when using Python 3.5: import cv2 cap = cv2.VideoCapture(0) Python2.7: print cap.isOpened() # prints True, further read() calls also return True Python3.5: print (cap.isOpened()) # prints False, and so are cap.open(), and of course cap.read(). What could cause such behavior? Thanks! 回答1: I had exactly the same problem. OpenCV was

Value error with dimensions in designing a simple autoencoder

怎甘沉沦 提交于 2019-12-13 06:29:36
问题 Hi I am trying out a simple autoencoder in Python 3.5 using Keras library. The issue I face is - ValueError: Error when checking input: expected input_40 to have 2 dimensions, but got array with shape (32, 256, 256, 3). My dataset is very small (60 RGB images with dimension - 256*256 and one same type of image to validate). I am a bit new to Python. Please help. import matplotlib.pyplot as plt from keras.layers import Input, Dense from keras.models import Model #Declaring the model encoding

How to scrape several websites with pyqt4, scope change?

烂漫一生 提交于 2019-12-13 04:58:11
问题 I would like to scrape two websites in java for links using PyQt4.QtWebKit to render the pages and then get the desired links. The code works fine with one page or url, but stops (but continues running until force quit) after printing the links of the first website. It seems the scope stays in the event loop of the render class. How can I get the program to change scope and continue with the for loop and rendering the second website? Using exit() in _loadFinished method just quits the program

How to plot interpolate station data over a map (basemap)?

旧时模样 提交于 2019-12-13 03:56:49
问题 I've got a file with accumulated rainfall over a month in 5 stations. There are lat, lon and rain data in csv file. My file is just like that: Out[18]: lat lon rain 0 -48.379000 -1.067000 213.0 1 -48.435548 -1.401513 157.2 2 -48.482217 -1.449707 147.0 3 -48.457779 -1.249272 182.6 4 -48.479847 -1.308735 49.4 I'm trying to do: import numpy as np import pandas as pd from matplotlib.mlab import griddata from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt from matplotlib

Python3, how to encode this string correctly?

北战南征 提交于 2019-12-13 03:14:58
问题 disclaimer, I've already done a long research to solve that alone but most of the questions I found here concern Python 2.7 or doesn't solve my problem Let's say I've the following (That example comes from BeautifulSoup doc, I'm trying to solve a bigger issue): >>> markup = "<h1>Sacr\xc3\xa9 bleu!</h1>" >>> print(markup) 'Sacré bleu!' For me, markup should be assigned to a bytes, so I could do: >>> markup = b"<h1>Sacr\xc3\xa9 bleu!</h1>" >>> print(str(markup, 'utf-8')) <h1>Sacré bleu!</h1>

Having nodes with differing lengths of attributes, add edges if >=1 attribute is the same

回眸只為那壹抹淺笑 提交于 2019-12-13 02:58:05
问题 In NetworkX 'm trying to accomplish the following: within one graph create 'mother-nodes' and 'children-nodes', where children-nodes have only 1 attribute, and mother-nodes have several (4). create edges between mother-nodes and children-nodes if at least one attribute (key-value pair) is the same, create an edge only between a mother-node and children-node: even if two mother-nodes have one of 4 overlapping attributes, there should not be an edge between the two So far I have the first part

flask 'hello world' not working

亡梦爱人 提交于 2019-12-13 02:56:40
问题 I copy pasted the flask's 'hello world' app from their website and am trying to run it. I get an error message in Chrome saying Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application. Here is the 'hello world' app straight from flasks website from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello World!' if __name__ == '__main__': app