Python is a dynamic and strongly typed programming language designed to emphasize usability. Two similar but incompatible versions of Python are in widespread use (2 and 3). If you have a version-specific Python question consider using the python-2.7 or python-3.x tags in addition to the python tag.

learn more… | top users | synonyms (3) | python jobs

0
votes
0answers
2 views

Python: Sqlalchemy messing up pyinstaller?

I am trying to package my program using pyinstaller. The code runs fine on windows, and uses SqlAlchemy, OpenCV and pyodbc packages. I ran pyinstaller to create the executable and tried to run it. I'...
0
votes
0answers
2 views

django rest auth facebook code for login

On project I use django-rest-auth for user registration and authentication. Also i added code for facebook login: from allauth.socialaccount.providers.facebook.views import FacebookOAuth2Adapter from ...
0
votes
0answers
3 views

Adding Namespaces to a DOM Element python

I want to produce this xml file with python and minidom: <xml vesion="1.0" encoding="utf-8?> <package name="Operation" xmlns="http://www.modelIL.eu/types-2.0" xmlns:xsi="http://www.w3.org/...
0
votes
0answers
1 view

Using scipy.integrate.ode with cython

I'm currently trying to use my already written python code with Cython in the hope of a better performance. However, I encounter problems at a point I use scipy.interpolate.ode: TypeError: f() ...
-1
votes
0answers
18 views

How to simplify nested for loops

I have the following Python code: listOfLists = [] for l1_index, l1 in enumerate(L1): list = [] for l2 in L2: for l3_index,l3 in enumerate(L3): if (L4[l2-1] == l3): ...
0
votes
1answer
23 views

Writing Russian characters to txt file using python

I try to write to txt file list with russian string. thefile = open('search_term.txt', 'w') for item in unique1: thefile.write("%s\n" % item) But in list this string looks correct. But after ...
0
votes
0answers
7 views

make pip ignore an existing wheel

If a .whl is available online, pip always installs it rather than compiling from source. However, for some specific module, the wheel happened to be compiled for the next processor generation and ...
-3
votes
0answers
13 views

Can anyone suggest a layout for this challengable algorithm?

enter image description here enter image description here As you can see, I want to optimize bus speed and signal timing techniques. You suppose that bus stops are near junctions which are bus ...
0
votes
0answers
5 views

Getting SSL Error with tweepy library python

I have attached a Screenshot of command prompt. I was successfully my code for tweets extraction belonging to a particular hashtag , but today i am getting this error. My code import tweepy from ...
0
votes
1answer
3 views

Building conda packages with conda skeleton

I'm trying to install a package not build in conda on Python 3.5 but founded on PyPi: "Seasonal" https://pypi.python.org/pypi/seasonal So I think I just have to do that : conda skeleton pypi ...
-6
votes
0answers
17 views

fix my code someone please [on hold]

can someone help me fix the errors in my code I've tried everything. I need this to be fixed for my coursework. Can someone please help me! def mainMenu(): menu = "\n\n\n===========================...
1
vote
1answer
5 views

(cv2,capture) object is not callable

Basically, this code will detect object's motion in the scene. When the motion is detected, a red rectangle frame will track the object's motion. But, I added a new function into the code which is ...
0
votes
3answers
19 views

Print on the same line; mantain until replaced by new string

I want to write a function that will output a message on a console line. The message should remain until I don't call the same function again with a new message. At that point, the new message should ...
0
votes
0answers
3 views

How to save spaCy model onto cache?

I'm using spaCy with Python for Named Entity Recognition, but the script requires the model to be loaded on every run and takes about 1.6GB memory to load it. But 1.6GB is not dispensable for every ...
-2
votes
0answers
7 views

“Radial grids must be strictly positive” error on radar chart

Whilst plotting my complex radar chart, I am getting the error "radial grids must be strictly positive", but all of the values and ranges I have used in my radar chart are all positive. Can someone ...
0
votes
0answers
9 views

python3 telnetlib.expect regex list syntax

What I am trying to match is the last 2 characters in b'\r\nas64512-edge#' (no whitespace). I don't care about the hostname, I just need to check if the prompt is # or > Whatever format I write, ...
-1
votes
0answers
24 views

Get Excel to display “Now” as text

I'm running a python script that reads a value from the screen and compares it to a value read from an excel spreadsheet. The problem I'm running into is that the value on the screen is: Now On the ...
0
votes
1answer
7 views

Pickle Security Risk for Personal Use

I am currently working on a small rpg to learn object oriented programming. I have got a nice little game and I was looking into implementing a "save" option to it. I had a look online and came ...
-9
votes
0answers
26 views

How do I create a program that takes the individual words of a sentence and stores them into a list [on hold]

How do I create a program that takes the individual words of a sentence and stores them into a list. It will then print the original sentence by replacing each word with its position in the sentence. ...
0
votes
0answers
4 views

cusolver library not found

I am trying to use skcuda in my python code but whenever i want to use it, it rises the following exception: Traceback (most recent call last): File "/home/rohola/Projects/Python/wordnetwork/s.py", ...
0
votes
1answer
11 views

OpenERP v7 on_change function returns number instead of value

def onchange_product_id(self, cr, uid, ids, product_id, context=None): val = { 'name': product_id, } return {'value': val} <field name="product_id" on_change="...
0
votes
2answers
12 views

sentiwordnet scoring with python

I have been working on a research in relation with twitter sentiment analysis. I have a little knowledge on how to code on Python. Since my research is related with coding, I have done some research ...
0
votes
0answers
4 views

How to get concurrent web response and perform heavy task in tornado? [duplicate]

I have created a web application using tornado. I want the web application to have the following functionality: It should be able to handle many simultaneous requests. For each request two things ...
0
votes
0answers
10 views

Pycharm debug watch: Can I show directly an image

Similar to the functionality available in Visual Studio I'd like to have a look at some of the variables in my code as images using PyCharm Community Edition 2016.1.4. In my case it's a mask that is ...
0
votes
0answers
11 views

Sphinx creating empty .rst files

Ive been trying to document my code but the command keeps producing empty .rst files. So I downloaded a template to test the autodoc feature and its also creating empty files. The template that I am ...
-3
votes
1answer
16 views

Adding django action to installed app

Is there any nice way add custom action to installed app admin? I don't want to subclass admin form. Also i don't want to modify original app code. Maybe contributing to class would work? Is it good ...
1
vote
0answers
21 views

Python running manage.py migrate wont work with MySQL db [duplicate]

Im working for a web application in Windows 10 using Python 3 and Django 1.9.7 I am trouble connecting the application to MySQL database. I installed certain tool to established connection with MySQL ...
0
votes
1answer
15 views

Error on Python serial import

When I try to import the serial I get the following error: Traceback (most recent call last): File "C:\Documents and Settings\eduardo.pereira\workspace\thgspeak\tst.py", line 7, in <module> ...
0
votes
0answers
7 views

Db in openshift is shutdown every 30 minutes

I have some problem with a postgresql cartridge in openshift. I created simple app using tornado(python) framework. In this app I used multithreading and run my app without python cartridge(because ...
0
votes
0answers
14 views

In Anaconda, how do you install a package which is not in the conda library? Specifically, I want to install the package apsw.

In Anaconda, how do you install a package which is not in the conda library? Specifically, I want to install the package apsw.
-9
votes
0answers
17 views

how to parse through this json in python which looks like [on hold]

{u'ITW_urls': [], u'additional_info': {u'androguard': {u'Activities': [u'com.yek.lafaso.ui.activity.WelcomeActivity', u'com.yek.lafaso.ui.activity....
-2
votes
1answer
28 views

How to save output of elif to a csv file in python?

import csv with open("input.csv") as f: d1 = [row[0] for row in csv.reader(f)] for x in d1: if 0<=int(x)<30: print("0<=x<30".format(x)) elif 40<=int(x)<120: ...
-5
votes
1answer
30 views

How to Iterate through a file, find a line, find duplicates, then go to the next line? [on hold]

I am a student doing some data profiling and I have a lot of data that I would like to sift through quickly. I would like to be able to identify lines in a file, then find the amount of duplicates, ...
1
vote
0answers
19 views

Jython - Integration Java and Python

I have sample python file, which i need to call through java program. For this is am using Jython. Pom Dependency <dependency> <groupId>org.python</groupId> <artifactId&...
-4
votes
1answer
31 views

List comprehensions

I want to append at the end of each list a value using one line for loop. this is my output: [[23, 34, 34] [34,21,34,56] [21,3,5,67]] but I want to append at the end of each list a value like ...
0
votes
2answers
26 views

Find the points with the steepest slope python

I have a list of float points such as [x1,x2,x3,x4,....xn] that are plotted as a line graph. I would like to find the set of points where the slope is the steepest. Right now, Im calculating the ...
0
votes
1answer
14 views

access hidden attributes of a class in python [duplicate]

demonstrates the way to hide the attributes of class and method to access the hidden variables outside the class class hiding(): # class attribute, "__" befor an attribute will make it to hide ...
0
votes
0answers
13 views

submit multiple files with different names in python request for post API

I have curl post api request as follows: curl -H "Authorization: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -H "X-Organization: xxxx" -k \ -H "Content-type: multipart/form-data; boundary=...
0
votes
0answers
4 views

Numpy fromregex OSError

I'm trying to load a 4GB text file with: import numpy as np regexp = r"^inetnum:\s*(?P<inetnum>.*[0-9.-])" ho = np.fromregex("ripe.txt", regexp=regexp, dtype=[('inetnum', np.str_,100)]) and ...
-2
votes
1answer
14 views

How to remove error in the following code?

n=int(raw_input()) w=set(map(int,raw_input().split())) N=int(raw_input()) L=list() for i in range(N): w=raw_input() L.append(w) for i in range(N): x=[] x=L[i].split() #print x[0] ...
-3
votes
0answers
6 views

NZEC python3.x error [on hold]

n=int(input()) result=[] for i in range(n) : x=input() r=int(x[0]) ch=list(map(int,x.split(' ',r))) small=ch[1] count=0 for i in range(1,len(ch)) : if ch[i]<small : ...
0
votes
0answers
18 views

Not able to get the actual content of web page in python

The URL: URL whose data I Want when traced through Python 2.7 using following code: from bs4 import BeautifulSoup import requests import urlparse import re import urllib import urllib2 URL=[...
0
votes
1answer
15 views

get() for default values in Pandas Series, using position

Is there a way in Pandas to get a default value, when accessing a row by position? I am aware of the .get() function, but that works when searching by index. Below is what I want to do. The DataFrame:...
1
vote
1answer
22 views

Exit gracefully at EOF

I am trying to parse a file, in which there is a part always present, and the past part is optional. for line in finp: # This part is always present for _ in range(int(ldata[2])): ...
0
votes
1answer
20 views

Scripting Language-> game engine -> Fem Application

Based on the book that I'm reading Game Coding Complete 4th edition ( Ch12 Scripting Language Integration Strategies) it made me believe that one can simplify and ease the process of creating ...
-4
votes
1answer
27 views

What's wrong with this implementation of a heap?

my insert method is not correct and I don't know why. my min method errors with not "builtin_function or object not subscriptable" I think that my conceptual understanding of heaps is OK. But its ...
2
votes
1answer
18 views

Efficient way to aggregate on dates in pandas groupby

When performing a groupby on dates (as object), I realized it was way less efficient than on int. Here is an example: df = pd.DataFrame({'id1':[1,1,1,1,2,2,2,3,3,3],'id2':[10,20,30,10,20,30,10,20,30,...
0
votes
0answers
4 views

Window extraction of matrix data

Consider a 2D array (100,100) with data at positions [i,k]. I would like to extract every value at each position [i,k], so that for each of them, I also extract the 8 values around. My code for the ...
1
vote
1answer
19 views

Probability of next day being specific values using Python Pandas

Using the following dataframe as an example, which specifies different directions for a stock market day. What are the most Pythonic approaches for capturing stats showing what is the most likely day ...
0
votes
1answer
6 views

Inaccurate search result from Google place API (Geocoding)

i am trying to geocode some addresses in the Philippines but when I do my search through the Google APIs, I only get very inaccurate results (10kms away from the point I am looking for while maps....