Python TypeError an integer is required pyHook pythoncom

Python
I wrote a script: import pythoncom, pyHook import time from time import strftime,localtime def OKBE(event): log =str("l...
3 years ago

loading a sparse matrix saved with np.save

Python
I saved a scipy csr matrix using np.save('X', X). When I load it with np.load('X.npy'), I get this signiture: array(<240760x110493 sparse matrix...
3 years ago

What Is a Pythonic Way to Build a Dict of Dictionary-Lists by Attribute?

Python
I'm looking for pythonic way to convert list of tuples which looks like this: res = [{type: 1, name: 'Nick'}, {type: 2, name: 'Helma'}, ...] To di...
3 years ago

Efficiently ploting a table in csv format using Python

Python
I am trying to plot a csv formatted table using Python. So far, I was able to get the result I wanted by reading similar questions on the site, but my...
3 years ago

HTTPError 403 (Forbidden) with Django and python-social-auth connecting to Google with OAuth2

Python
Using python-social-auth, I get a 403: Forbiden error message after accepting access from google ...
3 years ago

Can I stop my for loop in the given code from printing the incorrect number of times without getting rid of the for loop itself?

Python
codeword = input('Enter codeword : ') codeword = codeword.lower().replace(" ", "") for i in codeword: old = (chr(ord(i))) encrypt = input('Enter ...
3 years ago

Python Django "ImportError: No module named hashcompat"

Python
I'm learning python + Django by reading 《beginning django e-commerce》, after I have installed django-db-log, when running $python manage.py runserver,...
3 years ago

Make a list of a list from a list with consecutive numbers

Python
Here is my list a = [ 1, 2, 3, 6, 7, 9, 11, 14, 15, 16] I want to return a new list like this new_a = [ [1,2,3], [6,7], [9],...
3 years ago

Use Updated Value In Array

Python
This is the code that I am working with: import pandas as pd z = pd.Series(data = [1,2,3,4,5,6,7], index = xrange(1,8)) array = [] for i in range(1,...
3 years ago

Better way to check multiple variables equal a single value in Python

Python
In Python I want to check the following: if x is None and y is None and z is None and ... I'd rather say something like: if x, y, z is None: But...
3 years ago

We have @login_required, wheres @admin_required

Python
I have a method that I'd like to only execute if an admin is logged in. How do I decorate this method such that only admins can use it? How do group...
3 years ago

Zip with repeats to preexisting dictionary

Python
I have a dictionary of the form: my_dict = {'apples': 'NA', 'pears': 'NA', 'oranges': 'NA'} and a zip that looks like: my_zip = {([10, 10], 'apple...
3 years ago

should I call close() after urllib.urlopen()?

Python
I'm new to Python and reading someone else's code: should urllib.urlopen() be followed by urllib.close()? Otherwise, one would leak connections, corr...
3 years ago

Creating a new Image file in astropy with specified dimensions of another image file

Python
I'm having a problem wit fits file manipulation in the astropy package, and I'm in need of some help. I essentially want to take an image I have in f...
3 years ago

Django 1.7 - Cannot find tutorials

Python
I have been searching the net for any references or tutorials for learning Django. Since I'm going to learn it, it makes sense that I learn the newest...
3 years ago

Element not visible error (Python, Selenium)

Python
I'm having an issue where an error appears in my PYTHON GUI stating 'ElementNotVisibleException: Message: Element is not currently visible and so may ...
3 years ago

Renaming columns in pandas

Python
I have a data table using pandas and column labels that I need to edit to replace the original column labels. I'd like to change the column names in...
3 years ago

flask before request - add exception for specific route

Python
in my before_request() function, i want to redirect the user to /login if they are not yet logged in. is there a special variable that will give me th...
3 years ago

How do I count occurences of a unique label?

Python
I have a document that consists of labels like this: 201 202 205 201 203 204 201 If I wish to count the number of occurrences of each label and pri...
3 years ago

How to decode ascii in python

Python
I send cyrillic letters from postman to django as a parameter in url and got something like %D0%B7%D0%B2 in variable search_text actually if to print...
3 years ago