Data dodania Pytanie
2018-02-15 15:02 Obtaining an output from a function of a module writen in python2 to use it in a script written in python3 »
I have two scripts scriptpy2.py and scriptpy3.py. scriptpy2.py is a module written in python 2.7, whereas my main code scriptpy3.py is written in pyth...
(0) odpowiedzi
2018-02-11 12:02 Get corresponding time and value from json using Django (Python 2) »
The following is a sample of the JSON that I'm fetching from the source. I need to get certain values from it such as time, value, value type. The tim...
(1) odpowiedzi
2018-02-11 01:02 python2.7 response to client first then process (shopify webhook) »
I am building a webhook to connect Shopify with my dispatch. Shopify Webhook sends a json request and wait for 5 seconds, if it doesn't receive 200 ba...
(1) odpowiedzi
2018-02-10 22:02 Not able to print out the results after the for-loop »
I have the following code in Python: for root, dirs, files in os.walk(path): for file in files: image = Image.open(root + '/' + file).con...
(1) odpowiedzi
2018-02-09 04:02 how to make a copy of a class in python? »
I have a class A class A(object): a = 1 def __init__(self): self.b = 10 def foo(self): print type(self).a print self.b...
(2) odpowiedzi
2018-02-08 13:02 Python startswith function: printing non partially matched lines »
Hi I want to use the startswith function to print out the lines in fileY.txt which are NOT partially matched with the lines in fileX.txt In the scrip...
(1) odpowiedzi
2018-02-08 11:02 Python: str.startswith() and string comparison "==" not working »
I'm trying to read a string from a file and find words that start with "'param." This is my code: # -*- coding: utf-8 -*- inputfile = open('abc.json...
(1) odpowiedzi
2018-02-06 10:02 My answer is supposed to determine what it returns but, it always returns "Welcome to the game" »
Code is as follows: reply = str((raw_input("Do you want to play again? Y/N "))) if reply[0] == "y" or "Y": print "Welcome to the game" elif rep...
(1) odpowiedzi
2018-02-05 00:02 My split function is not working »
It's giving me eof parsing error. I don't know how to fix that split function. Please help. Thank you. #Is It An Equilateral Triangle? def equiTri():...
(1) odpowiedzi
2018-02-02 16:02 Iterate Over Dictionary »
The two setups using print(i, j) and print(i) return the same result. Are there cases when one should be used over the other or is it correct to use t...
(3) odpowiedzi
2018-02-01 15:02 How do I split a Very huge string And string without spaces?(python3) »
Firstly I have this long string s = '1MichaelAngelo' How can I get the output as new_s = '1 Michael Angelo' and as a list new_list = [1,'Mi...
(1) odpowiedzi
2018-01-31 19:01 Redirect all stdout/stderr globally to logger »
Background I have a very large python application that launches command-line utilities to get pieces of data it needs. I currently just redirect the ...
(2) odpowiedzi
2018-01-31 19:01 Parsing text files with "magic" values »
Background I have some large text files used in an automation script for audio tuning. Each line in the text file looks roughly like: A[BANANA] + B[...
(5) odpowiedzi
2018-01-31 03:01 UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 4: ordinal not in range(128) »
I'm facing some trouble with Unicode. I'm a beginner in programming, so I couldn't understand the other answers related to this issue here. TraceBack...
(1) odpowiedzi
2018-01-30 21:01 How to convert raw data to cyrilic reading data in python? »
I'm trying to write a social bot for vk. Everything works, but when the bot gets an answer from a user - for example if the user writes in Russian (Cy...
(0) odpowiedzi
2018-01-30 14:01 Tornado, futures and blocking functions in Python 2.7 »
I was showing a friend about how to call blocking functions in tornado and I went with the classic example of a RequestHandler calling a function that...
(0) odpowiedzi
2018-01-30 09:01 Virtualenv creation on Ubuntu does not work and takes forever »
I'm unable to create a virtualenv on Ubuntu. It takes forever and does not succeed eventually. Using base prefix '/home/corleone/miniconda3' New py...
(0) odpowiedzi
2018-01-28 12:01 Magnitude only reconstruction doesn't look correct, am I interpreting this correctly? »
I have implemented a method from "Phase retrieval from the magnitude of the Fourier transforms of nonperiodic objects" paper available at: https://pdf...
(1) odpowiedzi
2018-01-26 08:01 Make ghost.py's QWebView react to user actions (attach an event loop thread?) »
I'm opening a web page in ghost.py in IPython interactive console and showing its window to see the effect of my actions: import ghost s=ghost.Ghost(...
(1) odpowiedzi
2018-01-26 03:01 Changing python version environment inside python script »
I have two python scripts, first one (script1) works with python2 and second one (script2) works with python3. They are two codes that I have not wr...
(1) odpowiedzi
2018-01-23 12:01 mxnet regression divide by zero error »
Try to edit the example of https://mxnet.incubator.apache.org/tutorials/python/linear-regression.html to develop a machine learning solution for solvi...
(1) odpowiedzi
2018-01-22 21:01 Python os.walk encode character error »
I've got a function: for root, dirs, files in os.walk(directory): for file in files: if fnmatch.fnmatch(file, '*.php*'): path...
(0) odpowiedzi
2018-01-22 04:01 What does comparing types do in Python 2? »
Consider this code: class class1: pass class class2: pass class1 > class2 In Python 3, I (rightly) receive this error TypeError: '&gt...
(0) odpowiedzi
2018-01-19 17:01 Writing a nested dictionary to a .txt file »
I have a dictionary that looks like this {'Berlin': {'Type1': 96}, 'Frankfurt': {'Type1': 48}, 'London': {'Type1': 288, 'Type2': 64, 'Type3': 426},...
(2) odpowiedzi
2018-01-19 11:01 Capturing stdouts in joblib-parallelized for loops into strings »
I have a function fun(int) exported from a C++ library someCppLib into Python2, which internally writes to stdout (so, it doesn’t use Python's own p...
(0) odpowiedzi
2018-01-17 16:01 How does implicit relative imports work in Python? »
Assume I have the following files, pkg/ pkg/__init__.py pkg/main.py # import string pkg/string.py # print("Package's string module imported") Now, ...
(1) odpowiedzi
2018-01-15 18:01 How to create a lettered list using docx? »
I use python for teaching some of my science courses, where I use it to generate unique assignments and tests for students. I've run into an issue tha...
(1) odpowiedzi
2018-01-08 14:01 TeamCity treats cmdline python script parameters as python list objects »
I am running a python (2) script using the TeamCity (10.x) command line runner.. The command executable is set as: /usr/bin/python And the script p...
(1) odpowiedzi
2018-01-08 11:01 TypeError: expected string or Unicode object, numpy.ndarray found »
I am getting the following error when i try to run the code, #!/usr/bin/env python from cv2 import * import cv2 import utils import detectvegetation ...
(0) odpowiedzi
2018-01-07 23:01 tkinter: set askopenfilename to entry »
I'm trying to set askopenfilename to entry box. But I don't know how to do it. import Tkinter as tk from tkFileDialog import * import ttk class ESA...
(1) odpowiedzi
2018-01-07 22:01 I changed "python.exe" to "python3.exe" but now pip returns an error, how can i fix this? »
So in order to make my life easier, I changed Python 2.7 to "python2.exe and Python 3.6 to "python3.exe". I then added them to my path and am able to ...
(1) odpowiedzi
2018-01-05 04:01 File creation and compress on the same function »
I have the reader read data from database time to time and generate csv files. I want to create the compress files while reading from database. Curre...
(2) odpowiedzi
2018-01-04 22:01 Parse a user input to a function to fetch from another file »
So I have 2 files , file1.py and file2.py I have a couple of lists sam and dan from file2.py so when I try this from file1.py I get AttributeError:...
(2) odpowiedzi
2018-01-04 00:01 Python 2 Shared Name Import Issue »
I have a project that contains an error unique to Python 2 with regards to local vs site packages. +project +-+package_name [*] | +-+sub_1 | +-+sub...
(0) odpowiedzi
2018-01-03 15:01 Python 2.6 Installation Error: "There was no software found to install »
When I try to install Python 2.6, specifically Python 2.6.5, after trying to install I get a message saying "The installation failed. The Installer c...
(0) odpowiedzi