text stringlengths 226 34.5k |
|---|
Python Logging module not respecting setLevel below '30' (Warning)?
Question: I'm at a bit of a loss here. I could swear that I had this working earlier
last week. Today I've returned to it and can't seem to get logging to work.
In the below sample script, I hope to show a relatively complete demonstration
of my issue... |
"pwd" giving path on windows machine when run through python subprocess
Question: I wrote the following script called `file_I_executed.py`:
import subprocess
def main():
loc = subprocess.popen("pwd")
print loc
Which gave output:
C:\Python27\python.exe C:/Users/use... |
Unorderable types in Python: NoneType() and int(). Using an interface to make this method
Question: I am in the finishing stages of finishing up a project that is due on July 6,
2015 to get all the errors fixed. I seem to have run across an error in which
I have no discern-able answer:
File "Z:\Jordan ... |
Python trying to sort a list alphabetically after it has been sorted numerically
Question: Program: supposed to read a text and find the top ten most commonly used words
and sort them by frequency, then print the list in order. (this occurs when
the "--topcount" flag is called)
I am trying to slightly modify this prog... |
python delete specific line and re-assign the line number
Question: I would like delete specific line and re-assign the line number:
eg:
0,abc,def
1,ghi,jkl
2,mno,pqr
3,stu,vwx
what I want: if line 1 is the line need to be delete, then output should be:
0,abc,def
1,m... |
concatenate image in python
Question: any body can help identify the problem here?
i have the code here to concatenate H and L to present an image and whenever i
run the code i get :
np.concatenate((H,L))
>> ValueError: zero-dimensional arrays cannot be concatenated
but i don't know why H... |
How to use <Button-4> & <Button-5> to zoom in and out the image in python
Question:
def onWheel(event):
d = event.delta
if d < 0:
amt=0.9
else:
amt=1.1
canvas.scale(ALL, 200,200 , amt, amt)
canvas.bind("<Button-4>&<Button-5>", onWheel)
canvas.focus_set()
... |
Why is accessing a namedtuple by field name slower than accessing a class's member variable?
Question: We were doing some experiments to compare the access time in classes and named
tuples and observed something strange.
import time
from collections import namedtuple as namedtuple
class mycl... |
pandas add row instead of column
Question: I'm new to pandas, but trying to simply add a row
class Security:
def __init__(self):
self.structure = ['timestamp', 'open', 'high', 'low', 'close', 'vol']
self.df = pd.DataFrame(columns=self.structure) # index =
def what... |
Import a .so file from Django
Question: I have a C++ code
#include <Python.h>
static PyObject* py_veripy(PyObject* self, PyObject* args){
/* BODY */
return Py_BuildValue("i", 1);
}
// Bind Python function names to our C functions
static PyMethodDef veri... |
Using python with sqlite3
Question: I am using python 3.4.2 with sqlite3. import pypyodbc as pyodbc import sqlite3
print ("Connecting via ODBC")
#conn = pyodbc.connect('DSN=NZSQL')
print ("Connecting via ODBC")
# get a connection, if a connect cannot be made an exception will be raised here
... |
Sending data as key-value pair using fetch polyfill in react-native
Question: The following code is to make HTTP POST request with fetch polyfill:
fetch(url, {
method: 'post',
body: JSON.stringify({
'token': this.state.token
})
})
.then((response) => response.json())
... |
pyinstaller not reading my hook file and doesn't work with win32com.shell
Question: According to the docs of pyinstaller, if you name a file `hook-
fully.qualified.import.name.py` it will read this file whenever you do an
import of the matching `.py` file.
However, my script looks like this:
import pyth... |
How to allow users to login protected flask-rest-api in Angularjs using HTTP Authentication?
Question: **_Guys If My Question is not clear please comment below._**
**Basic HTTP Authentication for REST API in flask+angularjs**
I just want to login to the flask-rest-api in angularjs, **I don't know how to
send the logi... |
render_to_string() complains of a NoneType error
Question: So I'm testing my code in `python manage.py shell`, however I'm getting the
following error: `AttributeError: 'NoneType' object has no attribute 'find'`.
Here's what I've done in the app's `models.py`:
from djmoney.models.fields import MoneyFiel... |
How to perform local polynomial fitting in Python
Question: I have 200k data points and I'm trying to obtain derivative of fitted
polynomial. I divided my data set into smaller ones every 0.5 K, the data is
Voltage vs Temperature. My code roughly looks like this:
import pandas as pd
import numpy as n... |
How to display all the tables created in sqlite database on python3
Question:
import sqlite3
conn = sqlite3.connect('boo2.db')
c = conn.cursor()
x=c.execute("SELECT * FROM sqlite_master where type='table'")
for y in x:
print(x)
the output is
********************... |
Python - stop WSGI application after specific request
Question: I need to create an application that ends after receiving a specific request.
I use `wsgiref.simple_server` and run handling request in separate thread.
There is my code:
from wsgiref.simple_server import make_server
import re
import... |
generate a random string with only certain characters allowed to repeat in python
Question: Okay, I'm trying to generate a 10 character string containing specific
characters. With the conditions being, the letters can NOT be repeats (but the
numbers CAN), and the string can ONLY contain a total of TWO letters, no more,... |
Python audio just makes the windows ding noises
Question: So, I am using Python3 making something that plays songs. I have it working so
if I press 1, it plays the playlist, if I press 2, it plays the first song,
and if I press 3, it plays the second song. It works with Circles, but in the
playlist once it gets to Bull... |
Extending django user model and errors
Question: django 1.8.2
**this is my model:**
class AppUser(AbstractUser):
_SEX = (
('M', 'Male'),
('F', 'Female'),
)
_pregex = RegexValidator(regex=r'^\+?1?\d{9,15}$', message="Phone number must be entered in the for... |
Bundling data with your .spec file in PyInstaller
Question: So I've read all of the questions here and cannot for the life of me see why
this doesn't work. I have a .spec file that looks like this:
# -*- mode: python -*-
block_cipher = None
a = Analysis(['newtestsphinx.py'],
... |
How to know which file to open (and open it) in Python based on its name matching a pattern?
Question: I have a file whose name will get updated daily, but the name will always
match some simple pattern e.g. it will always begin with 'report' e.g.
**report 1 A 2X.csv**
How do I open the file on any given day, not know... |
Storing data in a data frame
Question: New to python I'm struggling with a way to combine operation on my raw data
and a way to store them in a data frame and then using it again with pandas
and R.
some example of my code:
if 'Subject' in f:
for i in range (len(time)):
(...)
... |
How to access/set 'select' tag in HTML with python
Question: I'm trying to extract events from a page of HTML - <http://www.staffordshire-
pcc.gov.uk/space/>
I want to select different areas using python but came unstuck with the
following HTML:
<select data-ng-options="key as value.name for (key,value)... |
Python - Get a function to overwrite a variable
Question: So I'm testing out some mechanics for a text-based game I was going to make.
If the player has armour it would halve the damage they take and if not they
would take full damage. The problem I'm having is that whenever I try to run
the functions twice, it resets ... |
Pygame Key events only detects a limited amount of keys being held down
Question: Hi I have used pygame (the modules for python) for a while. Now I have written
a RPG game that has multiple keys been held down at once. It seem that only 2
or 3 keys are detected whiles been held down. If anyone knows how to fix this
pro... |
Why do I have invalid syntax in default pygame.py?
Question: Always, when I want to use Python framework `pygame` and I want to compile it,
it's printing this:
Traceback (most recent call last):
File "/home/hanisek/game.py", line 1, in <module>
import pygame
File "/home/hanisek/py... |
Python: Float infinite length (Precision float)
Question: My code:
def calc_pi(acc):
pos = False
sum = 4.0
for i in range(2, acc):
if not pos:
sum -= 4.0/(2*i-1)
pos = True
else:
sum += 4.0/(2*... |
How can I save a plot in python using matplotlib?
Question: When using:
In [42]: tz_counts[:10].plot(kind='barh', rot=0)
it return:
Out[42]: <matplotlib.axes._subplots.AxesSubplot at 0x7fa216b464d0>
But I can't see any file, it isn't showing either.
I start learning python tod... |
Javascript 'require()' method
Question: In python, when you import a module the statements inside the 'if name ==
_main_ ' block of the imported module is not executed.
Is there any equivalent approach which can prevents the execution of unwanted
statements in the imported module in javascript?
Answer: Via [fuyushim... |
When it is necessary to close a file and when it is not in python?
Question: I was trying to write code that manages resources in a responsible way. I
understand that a common idiom to make sure a file is closed after using is
with open("filename.txt", 'r') as f:
# ...use file `f`...
Howeve... |
How to do feature selection and reduction on a LIBSVM file in Spark using Python?
Question: I have a couple of LIBSVM files with which I have to implement clustering in
spark using python. The file has **space** as the delimiter and the first
column represents the type [ 1 or -1] and the rest all are the features which... |
Import Error: No module name
Question: I am facing some issue while importing a class. The folder structure is as
below:
python_space
|_ __init__.py
|_ ds_Tut
|_ __init__.py
|_ stacks
|_ __init__.py
|_ stacks.py (contains class Stack)
|_ tre... |
NameError when using input() with Python 3.4
Question: I am a new Python user and I have been working through a number of tutorials.
This has included running some of the code from the Command Prompt. This
worked fine when I first tested the code but for some reason it seems to have
stopped working and I am now getting... |
Kivy and in-game sounds: Game update loop waits for sound to finish before continuing [FPS issues using SoundLoader in Kivy]
Question: I'm learning to program Python by making a game using Kivy, but I'm having
trouble implementing sounds for different events (eg. shield_on.play() when
shield-item is picked up.) because... |
DJANGO_SETTINGS_MODULE How to configure
Question: I am working in a project with Django 1.8 and Python-3.4 I want install the
mockups package for automate the data creation in my application. I've
installed this package with `pip install django-mockups` and `easy_install
django-mockups`
I add the 'mockups' entry in my... |
Python write text to .tar.gz
Question: I look for a possibility to write a text file directly (OnTheFly) in a .tar.gz
file with python. The best would be a solution like `fobj = open (arg.file,
"a")` to append the text.
I want to use this feature for long log files that you are not allowed to
split.
Thanks in advance... |
Is it required to close a Psycopg2 connection at the end of a script?
Question: What are the consequences of not closing a `psycopg2` connection at the end of
a Python script? For example, consider the following snippet:
import psycopg2
psycopg2.connect("dbname=test")
The script opens a connect... |
How can I press the button "enter" in python 2.7, without having the user pressing it, from code
Question: This question has probably been answered again, since I searched for it before
I asked this question. The people who answered said that win32api should be
used, but I don't know where it is, so I can import it(pyt... |
Python CSV read row by row and insert new data
Question: I have a csv file, from which I will read row by row and for certain field the
data need to be processed and insert the results into another field in the
same row before moving on to the next field.
I tried various methods like:
w = open('test.csv... |
Getting the value of selected item in optionMenu Tkinter
Question: I've made some optionMenu in Tkinter in python, I want to get the value that
has been selected by the user. I've used var.get() in the method that gets
called when an item is clicked but I'm not getting the correct value. I keep
getting "status", which ... |
Accesing script scope variables from modules
Question: We use IronPython in our open source project. I have problem accesing the
variables added to the script scope like
private ScriptScope CreateScope(IDictionary<string, object> globals)
{
globals.Add("starting", true);
globals.Add("... |
pseudo increasing the 'resolution' of a value table
Question: I have an measurement array with 16.000 entries in the form of
[t] [value]
the problem is my data logger is too slow and i only have measurement points
every second. For my simulation i need the resolution pseudo increased. So
that every... |
Truncated output using Python bottle 0.12.8 as a CGI application under Windows on an Apache server
Question: This is the application:
#!/home2/friendv0/Python-2.7.9/bin/python
from bottle import Bottle
app = Bottle()
@app.get('/')
def hello():
return """<!DOCTYPE ht... |
What happen in the background on a web server?
Question: I'm just started to learn back-end web development using Python and Flask
framework.
My first application is the simplest one and it returns _"Hello World!"_ when
the user send a request for website's homepage.
Below, you can see the structure of my application... |
Problems on Spark dealing with list of Python object
Question: I am learning Spark, and I just got a problem when I used Spark to deal with a
list of Python object. The following is my code:
import numpy as np
from pyspark import SparkConf, SparkContext
### Definition of Class A
clas... |
Python multiprocessing: Process object not callable
Question: So, recently, I've been experimenting with the multiprocessing module. I wrote
this script to test it:
from multiprocessing import Process
from time import sleep
def a(x):
sleep(x)
print ("goo")
a = Proces... |
How to plot a histogram by different groups in matplotlib
Question: I have a table like:
value type
10 0
12 1
13 1
14 2
Generate a dummy data:
import numpy as np
value = np.random.randint(1, 20, 10)
type = np.random.choice([0, 1... |
Issue with sending POST requests using the library requests
Question:
import requests
while True:
try:
posting = requests.post(url,json = data,headers,timeout = 3.05)
except requests.exceptions.ConnectionError as e:
continue
# If a read_timeout error occurs, st... |
How to archive a remote git repository programmatically using Python?
Question: I am trying to archive a remote git repo using Python code. I did it
successfully using Git command line with following command.
> git archive --format=zip --remote=ssh://path/to/my/repo -o archived_file.zip
HEAD:pat... |
Python unique grouping people task
Question: My task is to generate all posible way to group given number of people from
given number of total people. For example, if there are 4 guys at total, for
groups that contain 2 guys, I have to get array like this:
ResultArr = {0: [1,2], 1:[1,3], 2:[1,4], 3:[2,3]... |
ImportError: cannot import name GoogleCredentials
Question: I'm trying to use GoogleCredentials.get_application_default() in python in an
AppEngine project:
from oauth2client.client import GoogleCredentials
from ferris.core.google_api_helper import build
...
gcs = build("storage", "... |
An error in signature when pushing using pygi2
Question: I'm facing problem when pushing using pygit2 `v0.21.3` . here is my code :
import pygit2 as git
repo = git.Repository("path/to/my/repo.git") # just for testing,it will not be local
for rem in repo.remotes:
rem.push_url = rem.ur... |
Python 3.4 : How to do xml validation
Question: I'm trying to do XML validation against some XSD in python. I was successful
using lxml package. But the problem starts when I tried to port my code into
python 3.4. I tried to install lxml for 3.4 version. Looks like my enterprise
linux doesn't play very well with lxml.
... |
Do not require authentication for OPTIONS requests
Question: My settings.py
REST_FRAMEWORK = {
'UNICODE_JSON': True,
'NON_FIELD_ERRORS_KEY': '__all__',
'DEFAULT_AUTHENTICATION_CLASSES': (
# TODO(dmu) HIGH: Support OAuth or alike authentication
'rest_framewo... |
Compiling Cython with C header files error
Question: So I'm trying to wrap some C code with Cython. I read read applied Cython's
tutorials on doing this
([1](http://docs.cython.org/src/tutorial/clibraries.html),
[2](http://docs.cython.org/src/userguide/external_C_code.html)), but these
tutorials do not say much on how ... |
Get the title of a window of another program using the process name
Question: This question is probably quite basic but I'm having difficulty cracking it. I
assume that I will have to use something in `ctypes.windll.user32`. Bear in
mind that I have little to no experience using these libraries or even
`ctypes` as a wh... |
TypeError: Type str doesn't support the buffer API in assertTrue in testcase
Question: I am using python 3.4 and Django 1.8.2
I am performing some test cases about of the Artist object using some asserts:
I want that the page return me in my test of `/artist/<id>` (stored in the res
variable) and return me the 200 st... |
How to convert a set of osm files to shape files using ogr2ogr in python
Question: I strongly believe that this question is already asked but I can't find the
answer so I am placing it before you. I am having a problem while running the
script to convert osm files to shp files. The script is reading all the osm
files b... |
How to handle lists as single values in csv with Python
Question: I am handling a csv import and got troubles with a value that should be in
list form but is read as string.
One of the csv rows looks like the following:
['name1', "['name2', 'name3']"]
As you can see the value in the second col... |
Is there a significantly better way to find the most common word in a list (Python only)
Question: Considering a trivial implementation of the problem, I am looking for a
significantly faster way to find the most common word in a Python list. As
part of Python interview I received feedback that this implementation is s... |
Memory leak in reading files from Google Cloud Storage at Google App Engine (python)
Question: Below is part of the python code running at Google App Engine. It fetches a
file from Google Cloud Storage by using cloudstorage client.
The problem is that each time the code reads a big file(about 10M), the memory
used in ... |
Python key pressed without Tk
Question: I use a Raspberry Pi via SSH from my Windows 7 and I build a robot. If you
press an arrow, it will move. I detect the key with TkInter module, but it
needs a graphic environment. So if I am only in an SSH terminal, it can't run.
Is there some module which can detect keys and does... |
Create a list of lists using Python
Question: I have a list with year and day starting from December till February from 2003
to 2005. I want to divide this list into list of lists to hold year day from
December to February:
a = ['2003337', '2003345', '2003353', '2003361', '2004001', '2004009', '2004017',... |
How to replace None only with empty string using pandas?
Question: the code below generates a _df_ :
import pandas as pd
from datetime import datetime as dt
import numpy as np
dates = [dt(2014, 1, 2, 2), dt(2014, 1, 2, 3), dt(2014, 1, 2, 4), None]
strings1 = ['A', 'B',None, 'C']
... |
Python - Efficiently find the set of all characters in a pandas DataFrame?
Question: I want to find the set of all unique characters contained within a pandas
DataFrame. One solution that works is given below:
from operator import add
set(reduce(add, map(unicode, df.values.flatten())))
However,... |
Python - Pandas - Dataframe: Row Specific Conditional Column Offset
Question: I am trying to do a dataframe transformation that I cannot solve. I have tried
multiple approaches from stackoverflow and the pandas documentation: apply,
apply(lambda: ...), pivots, and joins. Too many attempts to list here, but not
sure whi... |
os.system(<command>) execution through Python :: Limitations?
Question: I'm writing a python (ver 2.7) script to automate the set of commands in this
Getting Started [example](http://inotool.org/quickstart) for
[INOTOOL](http://inotool.org/).
Problem: When I run this entire script, I repeatedly encounter these errors:... |
Python: print the time zone from strftime
Question: I want to print the time zone. I used `%Z` but it doesn't print:
import datetime
now = datetime.datetime.now()
print now.strftime("%d-%m-%Y")
print now.strftime("%d-%b-%Y")
print now.strftime("%a,%d-%b-%Y %I:%M:%S %Z") # %Z doesn't work
... |
Python: putting lists from a file into a list
Question: i'm very begginer in python.
i have a file with lists of coordinates. it seems like that :
[-122.661927,45.551161], [-98.51377733,29.655474], [-84.38042879, 33.83919567].
i'm trying to put this into a list with:
with open('file... |
How to pass weights to a Seaborn FacetGrid
Question: I have a set of data that I'm trying to plot using a FacetGrid in seaborn.
Each data point has a weight associated with it, and I want to plot a weighted
histogram in each of the facets of the grid.
For example, say I had the following (randomly created) data set:
... |
Do not require authentication for GET requests from browser
Question: This question is closely related to [Do not require authentication for OPTIONS
requests](http://stackoverflow.com/questions/31274810/do-not-require-
authentication-for-options-requests)
My settings.py
REST_FRAMEWORK = {
'UNICO... |
Entry widget doesn't work
Question: I'm fairly new to python and I need help with this problem. How do I get a
user to input something on canvas? I've tried taking out the `x=` and `y=` but
it doesn't work... after I run the module it says "Non-Keyword arg after
Keyword arg". Please help.
from tkinter im... |
New to Python (3.4.3), trying to pip install basic libraries and receiving this message
Question: `Command "C:\Python34\python.exe -c "import setuptools,
tokenize;__file__='C:\\Users\\Jamey\\AppData\\Local\\Temp\\pip-
build-4xxi4hts\\numpy\\setup.py';exec(compile(getattr(tokenize, 'open',
open)(__file__).read().replace... |
Parsing/Printing depending on char length in Python; only 98% on CodeEval
Question: So I'm working through a CodeEval problem right now, and, for some reason, I
can't get past a 98/100 score.
Here's a link to the challenge on CodeEval:
<https://www.codeeval.com/open_challenges/167/>
Here's my code:
# ... |
Plotting a bar chart from data in a python dictionary
Question: I have a dictionary in my python script that contains data I want to create a
bar chart with.
I used matplotlib and was able to generate the bar chart image and save it.
However that was not good enough because I want to send that bar chart out as
an emai... |
How to enable WASAPI exclusive mode in pyaudio
Question: I'm using [these](http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio)
precompiled binaries of pyaudio with WASAPI support. I want to play a wav file
via WASAPI. I found index of default output device for this api:
import pyaudio
p = pyaudi... |
sklearn classifier get ValueError: bad input shape
Question: I have a csv, struct is `CAT1,CAT2,TITLE,URL,CONTENT`, CAT1, CAT2, TITLE
,CONTENT are in chinese.
I want train `LinearSVC` or `MultinomialNB` with X(TITLE) and
feature(CAT1,CAT2), both get this error. below is my code:
PS: I write below code through this ... |
python average of random sample many times
Question: I am working with pandas and I wish to sample 2 stocks from **each trade
date** and store as part of the dataset the average "Stock_Change" and the
average "Vol_Change" for the given day in question based on the sample taken
(in this case, 2 stocks per day). The actu... |
Why is my program faster than the one using a python built in function?
Question: Ok so, I was doing a puzzle on coderbyte, and here is what the puzzle stated:
Have the function SimpleMode(arr) take the array of numbers stored in arr and
return the number that appears most frequently (the mode). For example: if arr
co... |
Django-storages-redux: cannot import name 'setting'
Question: I'm trying to deploy a Django website to Amazon Web Services using python 3.
Now, django-storages is not compatible with python3, so I installed django-
storages-redux, which is compatible. But, when I'm trying to:
python3 manage.py runserver
... |
Python - Readline skipping characters
Question: I ran into a curious problem while parsing json objects in large text files,
and the solution I found doesn't really make much sense. I was working with
the following script. It copies bz2 files, unzips them, then parses each line
as a json object.
import o... |
python equivalent of qx in perl-user/password prompt included
Question: In Perl, if I have execute a script and pass a password to it programatically,
I would do this:
my $result = qx { "Calling some script which prompts for a user and password" <<EOF
administrator
password
EOF
};
... |
How do I get the return value from a process run by subprocess.Popen?
Question: I am trying to assign the return value of `python --version` to a variable
using the code below.:
#! /usr/bin/env python
import os
import sys
import subprocess
os.system('pwd')
print ("check the versi... |
scrapy: spider destructor (__del__) never executed
Question: I have created an scrapy spider that works well (it does what is supposed to
do), but when finish working it doesn't execute the destructor code (**del**)
Versions are: \- python 2.7.3 \- scrapy 0.24.6 \- Fedora 18
class MySpider(scrapy.Spider... |
ValueError: endog must be in the unit interval
Question: While using statsmodels, I am getting this weird error: `ValueError: endog
must be in the unit interval.` Can someone give me more information on this
error? Google is not helping.
Code that produced the error:
"""
Multiple regression with dum... |
How to convert rows in DataFrame in Python to dictionaries
Question: For example, I have DataFrame now as
id score1 score2 score3 score4 score5
1 0.000000 0.108659 0.000000 0.078597 1
2 0.053238 0.308253 0.286353 0.446433 1
3 0.000000 0.083979 0.808983... |
installing PyGObject via pip in virtualenv
Question: I'm actually upgrading an old django app from python2.7 to python3.4. While
installing pygobject via pip, I got this error:
Collecting pygobject
Using cached pygobject-2.28.3.tar.bz2
Complete output from command python setup.py egg_info:
... |
Dynamic Datasets and SQLAlchemy
Question: I am refactoring some old SQLite3 SQL statements in Python into SQLAlchemy. In
our framework, we have the following SQL statements that takes in a dict with
certain known keys and potentially any number of unexpected keys and values
(depending what information was provided).
... |
How can I use regex to search for repeating word in a string in Python?
Question: Is it possible to search for a repeating word in a string use regex in
**Python**?
For instance:
string = ("Hello World hello mister rain")
re.search(r'[\w ]+[\w ]+[\w ]+[\w ]+[\w ]', string)
Can I do it so ... |
Scipy.linalg.eig() giving different eigenvectors from GNU Octave's eig()
Question: I want to compute the eigenvalues for a generalized eigenvalue problem with
lambda * M * v = K * v, where lambda is the eigenvalue, v is an eigenvector,
and M and K are matrices. Let's say we have
K =
1.8000 + ... |
<br> Tag parsing using python and beautifulsoup
Question: So I am trying to golf course extract data from a given website in which it
will create a CSV that contains the name and address. For the address though
the website where I am taking the data from has
tag breaking it apart. Is it possible to parse out the two ... |
Python Logging Module logging timestamp to include microsecond
Question: I am using python's logging module for logs, but needed the timestamp to
include microsecond. It seems the timestamp can only get as precise as
millisecond. Here's my test code
import logging
logging.basicConfig(format='%(a... |
Finding discrete logic levels in a waveform
Question: I have some waveforms that I'm trying to process with Python. I would like to
find discrete logic levels that these signals are displaying. I have a 1D
array of each waveform's x and y values.
The data looks something like this example staircase:
: File "test.py", line 3, in
conn=pyodbc.connect('DRIVER={Teradata};DBCNAME=**._**._... |
IndentationError: expected an indented block when use unicode
Question: I'm getting this error:
> IndentationError: expected an indented block when use unicode
but without:
def __unicode__(self):
return self.BankName
it work correctly.
My models.py:
from django.db import m... |
python TUI popup
Question: I need some hints to find a simple solution for inserting a popup window
inside a python console app.
This app runs normally unattended, because it's done to be launched from
crontab.
It uses everywhere logging to display messages and save them to logfiles.
However, in some cases, the a... |
python django user not authenticated with user object
Question: Ok I am facing this problem with authentication
user_profile = UserProfile.objects.get(email="[email protected]")
new_password = form.cleaned_data['new_password']
user_profile.user.set_password(new_password)
user_profile.user.save()... |
Can I link a Java library using Jython with my code in Python
Question: I need to use the library Jena which is in Java in my code that is written in
Python. Now, I want to know if Jython can bridge between these two or not!!!
according to [this
thread](http://stackoverflow.com/questions/9727398/invoking-jython-from-
p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.