Tagged Questions
Python is a dynamically and strongly typed programming language whose design philosophy emphasizes code readability. Two significantly different versions of Python (2 and 3) are in use. Please mention the version that you are using when asking a question about Python.
0
votes
0answers
7 views
socket.error: [Errno 19] No such device error
when i run this script for detecting cam table exhaustion detection script , the following error occur.
File "camtable.py", line 22, in <module>
sniff(iface=interface,prn=monitorPackets)
...
0
votes
0answers
5 views
using admin configuration in model file
The following code is working fine.
run.py
import datetime
from flask import Flask
from peewee import TextField, DateTimeField
from flask_peewee.db import Database
from flask_peewee.auth import ...
0
votes
0answers
21 views
Iterating through an array and searching for each item in the array in a file
I don't know if I'm even asking this question the right way, but I want to search through a log file and look for each word in an array. At this point, I've asked the user to drag the file in question ...
0
votes
0answers
5 views
Chaining queries in MongoEngine
I'm implementing a REST API for a standard CRUD app. In one example, to get a list of users, clients can call:
GET api.site.com/users (and optionally) ?name=x phone=x email=x
Passing the above ...
-1
votes
1answer
10 views
Can a cookiejar object be pickled?
I tried pickling a cookjar object.
import cookielib
import pickle
dumpFile = open('cookie.dump','w')
cj = cookielib.CookieJar()
pickle.dump(cj, dumpFile)
It raised a exception as
raise TypeError, ...
0
votes
1answer
14 views
shorter way to merge, shuffle and take first n elements of a list
I'm doing that (see code) and i'm thinking that there will be a shorter way
fd_list = list(set(fd_list1 + fd_list2 + fd_list3))
shuffle(fd_list)
fd_list = fd_list[:10]
what i want to do ...
0
votes
0answers
7 views
get the index of point which create ConvexHull
I tried to use scipy.spatial (from scipy.spatial import ConvexHull) function to draw convex hull of series of points.
import pylab as pl
from scipy.spatial import ConvexHull
pl.figure()
...
0
votes
1answer
13 views
Did I miss something? Tkinter label won't show
I tried to make a guessing game with tkinter and for some reason it won't work, here's my code. (EDIT) Fixed it.
from tkinter import *
from random import *
app = Tk()
app.title('Guess the number')
...
1
vote
0answers
11 views
__init__.py in project folder breaks nose tests
project tree:
.
|-- bar.py
`-- test
|-- __init__.py
`-- test_bar.py
bar.py:
def dumb_true():
return True
tests/test_bar.py:
import bar
def test_bar_true():
assert ...
0
votes
1answer
11 views
error in flask-peewee Admin User creation
Database example.db is created but generates error !!!
Traceback (most recent call last):
File "db_testing.py", line 39, in admin.save()
File ...
0
votes
0answers
15 views
Overriding Django Password Reset Email Directory
I'm attempting to change the location of templates for Django password reset emails, which are by default stored in /registration. Any ideas on how to do this? I currently have:
class ...
1
vote
0answers
23 views
How to pass a random generated value from a template to a view variable inside a definition using django
I am new to django and python, I am diving deep into the framework and got caught confused with syntax.
I am essentially trying to create a math game that will take random puzzles from a database ...
1
vote
4answers
44 views
Python, get milliseconds since epoch, millisecond accuracy (not seconds*1000)
How can I get the number of milliseconds since epoch?
Note that I want the actual milliseconds, not seconds multiplied by 1000. I am comparing times for stuff that takes less than a second and need ...
1
vote
0answers
13 views
How can pyinstaller incorporate shared library?
My python script imports a shared library (.so) which was generated by distutils.core from a C++ code. When I generate an executable using pyintaller, it prints out
The CococaAgg backend required ...
0
votes
2answers
31 views
Good Perl style: How to convert UTF-8 C string literals to \xXX sequences
[Python people: My question is at the very end :-)]
I want to use UTF-8 within C string literals for readability and easy maintainance. However, this is not universally portable. My solution is to ...