python-3.5

ValueError :Setting an array element with a sequence using numpy

白昼怎懂夜的黑 提交于 2019-12-07 12:31:53
问题 I have this piece of code in python data = np.empty(temp.shape) maxlat = temp.shape[0] maxlon = temp.shape[1] print(maxlat,maxlon) for i in range(0,maxlat) : for j in range(0,maxlon): data[i][j] = p_temperature(pr,temp[i][j]) When I run this code in Python 3.5, I get this error ValueError : setting an array element with a sequence The value of maxlat is 181 and the value of maxlon is 360 . The shape of temp array is (181,360) I also tried the suggestion in the comments: for i in range(0

Tf.Print() doesn't print the shape of the tensors?

笑着哭i 提交于 2019-12-07 12:15:49
问题 I have written a simple classification program using Tensorflow and getting the output except I tried to print the shape of tensors for Model parameters, features & bias. The function definations: import tensorflow as tf, numpy as np from tensorflow.examples.tutorials.mnist import input_data def get_weights(n_features, n_labels): # Return weights return tf.Variable( tf.truncated_normal((n_features, n_labels)) ) def get_biases(n_labels): # Return biases return tf.Variable( tf.zeros(n_labels))

uploading photos to Craigslist with Python and Selenium

一个人想着一个人 提交于 2019-12-07 07:46:17
问题 using python3, selenium with firefox on windows10: this program is simple. it jumps directly to craigslists 'post a new listing' page, uploads multiple photos, then submit. the problem im having is that i cannot control a dialog box to navigate to the correct file with selenium. browser = webdriver.Firefox() browser.get('https://post.craigslist.org/k/lPbhT6Lh5RGBKb-uS1zr0g/g2NjN?lang=en&cc=us&s=editimage') #opens to craigslists 'Upload/Edit Images' page add_imgs_btn = browser.find_element_by

how to switch between two application using pywinauto 0.5.4

拜拜、爱过 提交于 2019-12-07 07:20:29
I am trying to automate a task of copying every single line one by one from Notepad and pasting it the application and then clicking at a button and then copying the output to a third notepad file. I am using pywinauto 0.5.4 of python for this automation and I am not getting any help on how to switch between different application from pywinauto import application app = application.Application() app = application.Application() app.start("Notepad.exe") app.start("C:\Program Files (x86)\eSpeak\eSpeakedit.exe") I am using this code for starting two apps. How to switch between these two application

Cannot install pymssql on windows

强颜欢笑 提交于 2019-12-07 04:48:37
问题 i am trying to install pymssql as pip install pymssql i have windows 7 and python 3.5 (from anaconda) but i get Failed building wheel for pymssql i believe its related to freetds and python-dev . how do i install these on windows? Which packages would i need to install? this pip install worked just fine for python 2.7. If the pip does not work,is there any other way i can download and install pymssql? 回答1: I just went through this small bit of hell and finally got things working, here is what

Python 3.5 pip 9 AttributeError: 'NoneType' object has no attribute 'bytes'

不问归期 提交于 2019-12-07 04:46:49
问题 What is the problem? I tried " python -m pip install -U pip " and " python -m pip install --upgrade pip " both with the same error (and " pip install -U --force-reinstall pip "). what should I do? C:\Users\Peyman\PycharmProjects\untitled3>python -m pip install -U pip Collecting pip Using cached https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl Installing collected packages: pip Found existing installation:

cxfreeze aiohttp cannot import compat

扶醉桌前 提交于 2019-12-07 02:26:38
问题 I'm trying to use cx_freeze to build a binary dist for an web application written in Python 3 using the aiohttp package. Basically I did: cxfreeze server.py and got a dist output But when running the ./server binary, I got the following message: File "/usr/local/lib/python3.5/dist-packages/cx_Freeze/initscripts/__startup__.py", line 12, in <module> __import__(name + "__init__") File "/usr/local/lib/python3.5/dist-packages/cx_Freeze/initscripts/Console.py", line 24, in <module> exec(code, m._

AttributeError: module 'urllib' has no attribute 'parse'

妖精的绣舞 提交于 2019-12-06 18:17:34
问题 python 3.5.2 code 1 import urllib s = urllib.parse.quote('"') print(s) it gave this error: AttributeError: module 'urllib' has no attribute 'parse' code 2 from urllib.parse import quote # import urllib # s = urllib.parse.quote('"') s = quote('"') print(s) it works... code3 from flask import Flask # from urllib.parse import quote # s = quote('"') import urllib s = urllib.parse.quote('"') print(s) it works,too. because of flask? Why I don't have the error anymore? is it a bug ? 回答1: The urllib

Heroku Python3.5 Import Error : No module named ='_tkinter'

痞子三分冷 提交于 2019-12-06 16:14:06
While deploying in Heroku and adding customized buildpacks such as libspatialindex, another error occurred where Python 3.5 now looks for Tkinter. Locally, by installing using sudo apt-get tk-dev this would be solved and trying out the suggestion from this similar problem: import matplotlib failing on Heroku , the error still persists. Here are my buildpacks: https://github.com/heroku/heroku-buildpack-apt heroku/python https://github.com/julienfr112/libspatialindex-buildpack.git And my Aptfile containing only: python3-tk libpq-dev build-essential libncursesw5-dev libreadline5-dev libssl-dev

LINK : fatal error LNK1104: cannot open file 'MSVCRT.lib'

余生长醉 提交于 2019-12-06 13:40:19
I am trying to download a channels package for making a chatbot by using google tensorflow. But, I am getting the following error: 3.5\twisted\words\im copying src\twisted\words\xish\xpathparser.g -> build\lib.win-amd64-3.5\twis ted\words\xish running build_ext building 'twisted.test.raiser' extension creating build\temp.win-amd64-3.5 creating build\temp.win-amd64-3.5\Release creating build\temp.win-amd64-3.5\Release\src creating build\temp.win-amd64-3.5\Release\src\twisted creating build\temp.win-amd64-3.5\Release\src\twisted\test C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\cl