text
stringlengths
256
65.5k
I have to parse an input string in python and extract certain parts from it. the format of the string is (xx,yyy,(aa,bb,...)) // Inner parenthesis can hold one or more characters in it I want a function to return xx, yyyy and a list containing aa, bb ... etc I can ofcourse do it by trying to split of the parenthesis an...
I have a GAE datastore with 303 Game() entities. class Game(db.Model): title = db.StringProperty(required = True) slug = db.StringProperty(required = True) category = db.CategoryProperty() description = db.TextProperty(required = True) created = db.DateTimeProperty(auto_now_add = True) The 'slug' p...
I have a string buffer of a huge text file. I have to search a given words/phrases in the string buffer. Whats the efficient way to do it ? I tried using re module matches. But As i have a huge text corpus that i have to search through. This is taking large amount of time. Given a Dictionary of words and Phrases. I ite...
When I try to run sudo ./manage.py runserver, I get the following error: Traceback (most recent call last): File "./manage.py", line 9, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 429, in execute_from_command_line uti...
luc765 Re : Synthèse vocale SVOX Pico Merci à frafra et tuxmuraille, pour votre travail. J'utilisais espeak avec mbrola, la qualité de SVOX est nettement meilleure J'ai installé gSpeech sur Lucid via la compilation pour SVOX. Tout est parfait. Dans l'utilisation est-il possible de modifier la vitesse de lecture par un ...
Was given some code (I am using Python 3.2), and keep getting the below error. import csv import collections import itertools grid = collections.Counter() with open("test1.csv", "r") as fp: reader = csv.reader(fp) for line in reader: for pair in itertools.combinations(line, 2): grid[pair] += 1 grid[...
[curl_easy_setopt] is used together with the [curlopt_*] methods. They are all used for the same purpose – to set different options for the curl operation. For more information, look at the respective [curlopt_] method. [curl_easy_setopt] is used to tell libcurl how to behave. By using the appropriate options to [curl-...
Hello World All of these examples assume you have access to a Yhat instance (either through the public sandbox or enterprise) and a Yhat username and apikey. To signup for the sandbox version of ScienceOps, go here You'll also need to have the Yhat client library installed $ pip install -U yhat. Deploying Your First Mo...
Composite Manager Retained Drawing Protocol RFC Robert Carr 02/28/07 Outline and justification: Results from development in the creation of 'first generation' mainstream composite window managers has outlined the need for several reconsiderations in regards to applications interacting and communicating with the composi...
Introduction to MapReduce with Hadoop on Linux When your data and work grow, and you still want to produce results in a timely manner, you start to think big. Your one beefy server reaches its limits. You need a way to spread your work across many computers. You truly need to scale out. In pioneer days they used oxen f...
I am trying to deploy my Python + Django project to the Google App Engine. Right now it works fine on my local computer, but when I try running it as a project within the Google App Engine, I get the following error. ImproperlyConfigured: 'django.db.backends.sqlite3' isn't an available database backend. Try using djan...
I'm trying to get authenticated by an API I'm attempting to access. I'm using urllib.parse.urlencode to encode the parameters which go in my URL. I'm using urllib.request.urlopen to fetch the content. This should return 3 values from the server, such as: SID=AAAAAAAAAAA LSID=BBBBBBBBBBB AUTH=CCCCCCCCCCC The problem is...
vince06fr Re : Nettoyage dans les noyaux (kernel) Umuntu : Si tu veux prendre le temps de traduire ce script, surtout ne te gêne pas comme tout est "hardcodé" dans le script, la seule chose à faire est... De modifier l'ensemble des textes en français présents dans le script pour les mettre en anglais. Une fois le scrip...
What should a ‘cache’ be? It means a lot of things, but to my mind the default programming type should be: “keep around expensive-to-generate bits of read-only data in case we need them again, or until the computer really needs that RAM for something else” I was writing a custom video editing program in Python (interes...
What is the python module to count number of ones in a binary image ? to rephrase, I have a matrix that has only ones and zeros, it's of numpy array type and I want to know how many ones are there. You can simply use >>> import numpy >>> n = numpy.random.randint(0, 2, size=(3,3)) >>> n array([[1, 0, 1], [0, 1, 1...
You can use .split() to split up the string of numbers and then turn each one into an integer: nums = [int(num) for num in raw_input('Enter some numbers: ').split(',')] Or you can use ast.literal_eval() and input a Python object: from ast import literal_eval nums = literal_eval(raw_input('Enter some numbers: ')) # Ty...
Microsoft Vista’s Endless Security Warnings The feature is called User Account Protection (UAP) and, as you might expect, it prevents even administrative users from performing potentially dangerous tasks without first providing security credentials, thus ensuring that the user understands what they’re doing before maki...
The Problem: Configuration Sprawl Over time, programs gain features and options. When they connect to external systems and services (e.g. databases, event brokers, cloud/web services), they must also keep a growing set of configs and credentials for those services handy. The traditional places to store this information...
I need to be able to copy a linphone 3.5.2 binary to other PCs without having to install it every time. I was trying to compile a portable linphone, however no configure args helped: ./configure --enable-static --disable-strict --disable-rpath --disable-shared \ --disable-x11 --enable-fast-install --enable-console_ui=...
In this sample code the URL of the app seems to be determined by this line within the app: application = webapp.WSGIApplication([('/mailjob', MailJob)], debug=True) but also by this line within the app handler of app.yaml: - url: /.* script: main.py However, the URL of the cron task is set by this line: url: /tasks/su...
I'm not 100% on this, but doing an outer join and dropping the NAs is the same as an inner join. So in the case of no matching indicies, you just get an empty dataframe. If we modify your example to include one matching record, this appears to be the case: import pandas as pd d1 = pd.DataFrame({ 'i1': [1, 2, 2], ...
I have a problem with gtk.FileChooserButton in a Python script. If you choose the option ›Other ...‹ from the button menu, the gtk.FileChooserDialog opens where you can select a new folder. If I select this new folder by double-clicking it and confirm the dialog by clicking on ›Open‹, the selected folder name i...
Is there a way to use the DPAPI (Data Protection Application Programming Interface) on Windows XP with Python? I would prefer to use an existing module if there is one that can do it. Unfortunately I haven't been able to find a way with Google or Stack Overflow. EDIT: I've taken the example code pointed to by "dF" and ...
Say I have an entity that looks a bit like this: class MyEntity(db.Model): keywords = db.StringListProperty() sortProp = db.FloatProperty() I have a filter that does a keyword search by doing this: query = MyEntity.all()\ .filter('keywords >=', unicode(kWord))\ ...
ADcomp Re : ADesk Bar : Barre de lancement rapide [python/gtk/cairo] @sam7 : je suppose que tu parles de mon live "Madbox" .. comme je te l'ai dit sur l'autre post, il n'est pas prévu pour une installation "normale" et les paquet *-fr ne sont pas installés. Sinon , j'ai une mise à jour de mon live en cours ( plus conve...
Enhancing the DocumentTemplate Although MFC and PythonWin support multiple document templates, there's a slight complication that isn't immediately obvious. When MFC is asked to open a document file, it asks each registered DocumentTemplate in turn if it can handle this document type. The default implementation for Doc...
According to the doc The subquery_factoring_clause now supports recursive subqueryfactoring (recursive WITH), which lets you query hierarchical data.This feature is more powerfulthan CONNECT BY in that it provides depth-first search and breadth-first search, and supports multiple recursive branches. A new search_clause...
raspouillas Re : Topic des lève-tôt… Faisons manger leurs caleçons aux couche-tard! [4] Je ne faisait aucune allusion au problème de @souen. Dernière modification par raspouillas (Le 15/06/2012, à 20:37) ljere Re : Topic des lève-tôt… Faisons manger leurs caleçons aux couche-tard! [4] alors voici la première partie du ...
I have got stuck on a problem, I have this GUI in wxpython, where i want to load in a file, and then i want to see the textfiles name in the textCtrl which has already been put onto the panel here is my code def __init__(self, parent): wx.Frame.__init__(self, parent, wx.NewId(), "Load PDB",size=(240,200)) panel...
Ruby Find awk in the PATH of a Unix clone. p = ENV['PATH'].split ':' # Find an executable in PATH. def find_exec(name) p.find {|d| File.executable? File.join(d, name)} end printf "%s is %s\n", 'awk', find_exec('awk') Oops! $ ruby21 find-awk.rb find-awk.rb:5:in `find_exec': undefined method `find' for nil:NilClass (N...
Mibixy Re : Live Voyager 12.10 bonjour, bonsoir, joyeux noël voilà je viens poster là parce qu'après de longues recherches, (peut-être pas au bon endroit.. pas avec les bons mots clefs je ne sais pas...) je ne trouve pas de script de connexion vpn pour les intégrer à wicd... NM fonctionne très mal chez moi. pourquoi ? ...
My name is Rob, I live in Austin TX. Thanks for stopping by. This blog covers any and all topics that catch my interest, you're as likely to find a post about software development as you are one on Danish axes. Feel free to email me if you have questions or comments. The first place we want to start when writing an emu...
pops logiciel d'animation en pixel art Bonjour, Je voulais vous présenter un petit logiciel d'animation en pixel art sur lequel je travaille depuis un peu plus d'un mois. C'est encore très sommaire, mais il commence a être utilisable : On peut dessiner avec des couleurs indexées, animer, il y a quelques brosse et on pe...
I am using a custom authentication backend with Django, to automatically create and login users from a legacy system. My Backend class is this: from django.contrib.auth.backends import ModelBackend from django.contrib.auth.models import User from sfi.models import Employee import base64, hashlib class SFIUserBackend(Mo...
Can you change which values are included and how they are formatted, when you download a report as a CSV file from Toggl? I would like to get the duration of the different tasks in a format that numbers can understand as a duration value. No, it is not possible to change it when downloading. However, you can load it in...
I am having a dict(containing lists) and a list, which I want to compare: The first thing, I want to find out is whether each value-list (e.g. for issue1, the value-list is [1, 1, 0, 0, 0, 1, 1, 1]) in ref has the same length as the list abf. Then comes the tricky part: If they have the same length, I want to compare e...
I recently wrote a rather ugly looking one-liner, and was wondering if it is better python style to break it up into multiple lines, or leave it as a commented one-liner. I looked in PEP 8, but it did not mention anything about this This is the code I wrote: def getlink(url): return(urllib.urlopen(url).readlines()[...
I'm accessing a C struct which contains some time_t fields using python ctypes module. Given its non completely portable nature, I cannot define these fields statically as of c_int or c_long type. How can I define them to make my code portable? Example C struct definition: #import <sys/types.h> #import <time.h> typedef...
milambert [résolu] kde et clef usb?? salut. lorsque je connecte ma clef usb, konqueror s'ouvre et me dit "sda1 not found" ou qqch dans le genre. En fait, le fichier sda1 n'est pas existant dans la partie media:/ de kde (partie ou tout les liens vers les periferique se trouvent). Serait il possible de créé ce lien. ps: ...
Some background information: We have an ancient web-based document database system where I work, almost entirely consisting of MS Office documents with the "normal" extensions (.doc, .xls, .ppt). They are all named based on some sort of arbitrary ID number (i.e. 1245.doc). We're switching to SharePoint and I need to re...
I just have a billion items in Safari's reading list and I would like the links to all of them. Is there a way to get all of the items in your reading list as links (maybe in a text document)? I whipped up a Python script to read the plist file referenced in the question patrix mentioned in the comments. #!/usr/bin/env...
Datetime is a module that allows for handling of dates, times and datetimes (all of which are datatypes). This means that datetime is both a top-level module as well as being a type within that module. This is confusing. Your error is probably based on the confusing naming of the module, and what either you or a module...
During the course of a given week, I answer a lot of technical questions. They range from the friend asking, “What laptop should I buy?” to strangers with very specific questions about the source code used in my research. I rather enjoy solving technical questions and taking a line from Jon Udell’s ”Too busy to blog?” ...
I have two lists of objects. Each list is already sorted by a property of the object that is of the datetime type. I would like to combine the two lists into one sorted list. Is the best way just to do a sort or is there a smarter way to do this in Python? People seem to be over complicating this.. Just combine the two...
For some reason I receive an ImportError every time I try to import a class from another file. Here's the github page for my project: https://github.com/wheelebin/mcnextbot Here's the error that I'm receiving: Traceback (most recent call last): File "ircbot.py", line 36, in <module> from test import mcnextlvl Imp...
There is some question about the extent to which Lion and FileVault is vulnerable to Firewire DMA attacks. I performed some research (full paper is available below) and can present the following results:Retrieving plain text passwords from RAM on Mac OS Lion (10.7) can be done under most circumstances where the system ...
I have a django view that I want to return an Excel file. The code is below: def get_template(request, spec_pk): spec = get_object_or_404(Spec, pk=spec_pk) response = HttpResponse(spec.get_template(), mimetype='application/ms-excel') response['Content-Disposition'] = 'attachment; filename=%s_template.xls' %...
use the following search parameters to narrow your results: e.g. subreddit:aww site:imgur.com dog subreddit:aww site:imgur.com dog see the search faq for details. advanced search: by author, subreddit... ~33 users here now Welcome to r/DailyProgrammer! First time visitors of Daily Programmer please Read the Wiki to lea...
rmanf30 Re : Test de Qualité des Codecs Libre VS x264 - Septembre 2010 Ma surprise à propos des paramètres été justifiée, apparemment ils ne sont pas corrects. -sn -vcodec huffyuv -acodec flac %1.mkv J'ai le message d'erreur suivant : "Peut-être des paramètres incorrects tels que bit_rate , le taux , la largeur ou la h...
Possible Duplicate: How to move SHP to gdb with ArcView license? Let's cut it short, I have numerous mxd with layer coming from .SHP and various servers WMS that I need to move to a gdb. What I want is to open the mxd and run a script that select all .SHP layers in the TOC create a gdb, export the .SHP, and create a ne...
I'm trying to create a system where a Person is part of one WorkGroup, and each WorkGroup contains many Person s. Person also contains a list of previously-matched Person s. Below is what I have so far, and I'm able to load test names into it successfully. However, when, in the findPartner method, I try to assign a new...
import pyaudio import wave chunk = 1024 wf = wave.open('yes.mp3', 'rb') p = pyaudio.PyAudio() stream = p.open( format = p.get_format_from_width(wf.getsampwidth()), channels = wf.getnchannels(), rate = wf.getframerate(), output = True) data = wf.readframes(chunk) while data != '': stream.write(data) ...
In Windows environment there is an API to obtain the path which is running a process. Is there something similar in Unix / Linux? Or is there some other way to do that in these environments? If you want the path of the current executable, look at A little bit late, but all the answers were specific to linux. If you nee...
Python newbie here, newer still to Pmw: I have the following method defined for showing a Pmw MessageDialog box, and it works as expected and the result value is returned and posted in edit1, which is a Tkinter.Text widget; 'self' here is a Tkinter.Frame. (running Win7-32 and Python v2.7.2): def _showMessageBar(self): ...
Gaara [script] Notification de mise à jour automatiques Bonjour à tous, J'ai créé un script en GTK-python (2.7) qui permet l'affichage d'une notification lors du téléchargement et de l'installation des mises à jour automatiques via le paquet unattended-upgrade. Ce paquet est installé par défaut, mais n'est pas activé. ...
I was quite amazed by the power of IPython Notebook when I recapped my Machine Learning notes: it seamlessly integrates a Markdown editor, a TeX equation editor powered by MathJax and inline chart rendering from matplotlib. There is only one thing missing: how can I integrate the IPython notebook to my nanoc workflow? ...
Cooking with Python, Part 1 Pages: 1, 2 Recipe 5.10: Selecting the nth Smallest Element of a Sequence Credit: Raymond Hettinger, David Eppstein, Shane Holloway, Chris Perkins Problem You need to get from a sequence the nth item in rank order (e.g., the middle item, known as the median). If the sequence was sorted, you ...
I'm trying to time some code. First I used a timing decorator: #!/usr/bin/env python import time from itertools import izip from random import shuffle def timing_val(func): def wrapper(*arg, **kw): '''source: http://www.daniweb.com/code/snippet368.html''' t1 = time.time() res = func(*arg, **...
I'm a novice Python user but I have written code to read a CSV into a python dictionary, which works fine. But I'm at the end of my rope trying to get the dictionary back to a CSV. I have written the following: import csv itemDict={} listReader = csv.reader(open('/Users/broberts/Desktop/Sum_CSP1.csv','rU'), delimiter =...
pyburrow - low-level web crawling library (Python 3) pyburrow is a Python 3 library for crawling websites: capturing,archiving and processing their resources. It is different from allother known crawlers by being very low level: the HTTP response bodyis stored as raw unencoded bytes, and further the HTTP responseheader...
I'm using shelve to store some data. Traceback (most recent call last): File "rogue.py", line 312, in <module> curses.wrapper(game) File "/usr/lib/python3.3/curses/__init__.py", line 94, in wrapper return func(stdscr, *args, **kwds) File "rogue.py", line 289, in game save_game(y,x) File "rogue.py", line...
Capybara Capybara helps you test web applications by simulating how a real user would interact with your app. It is agnostic about the driver running your tests and comes with Rack::Test and Selenium support built in. WebKit is supported through an external gem. Need help? Ask on the mailing list (please do not open an...
To be precise, a block ends when it encounter a non-empty line indented at most the same level with the start. This non empty line is not part of that blockFor example, the following print ends two blocks at the same time: def foo(): if bar: print "bar" print "baz" # ends the if and foo at the same time Th...
This is more of a curiosity question than anything else. I'm new with Python and playing around with it. I've just looked at the base64 module. What if instead of doing: import base64 string = 'Foo Bar' encoded = base664.b64encode I wanted to do something like: >>> class b64string(): >>> <something> >>> >>> string =...
I wrote the following program to prime factorize a number: import math def prime_factorize(x,li=[]): until = int(math.sqrt(x))+1 for i in xrange(2,until): if not x%i: li.append(i) break else: #This else belongs to for li.append(x) print li ...
#1926 Le 06/02/2013, à 18:17 Didier-T Re : [Conky] Alternative à weather.com (2) il manquait certaines info #! /usr/bin/python3 # -*- coding: utf-8 -*- # Par Didier-T Forum Ubuntu.fr import urllib.request, os, time, re, sys from bs4 import BeautifulSoup homedir = os.path.expanduser('~') #### initialisation des variable...
mastergb Vpnautoconnect 2.X(Nouvelle version ,bugs, demande d'aide: c'est ici!) Bonjour à tous, Suite à l'énorme thread précédent (et à la demande de ljere) , j'aimerais reprendre un sujet vraiment dédié a vpnautoconnect. Le logiciel n'est plus à présenter. On l'aime (ou pas), il permet entre autre de répondre à une la...
AnsuzPeorth Re : [Script] reconnaissance vocale avec google Je voulais aider mais, je viens de voir mes intérêts pas mal modifiés (girl power tongue ).... Euh, non, suis pas d'accord, et mon beta testeur ?? Qui va apposer le HUG (HizokaUsineaGaz) ??? T'as raison, ca tiens plus chaud une femme qu'un pc Hors ligne n3o51 ...
Here is my first attempt at such a script. Currently it prints out new questions to stdout. Maybe I will add a pluggable output class so that it can be emailed or SMSed or popped up on screen. For example, to track Python use $ python sofeed.py python Here is the code. Edit: changed getNewQuestions to generator without...
How to fetch multiple documents from CouchDB, in particular with couchdb-python? Easiest way is to pass a include_docs=True arg to Database.view. Each row of the results will include the doc. e.g. >>> db = couchdb.Database('http://localhost:5984/test') >>> rows = db.view('_all_docs', keys=['docid1', 'docid2', 'missing'...
In some of my tests I am having a problem that they fail on Travis because of time and time zone problems, so I want to mock system time for my test. How can I do this? AFAIK, you can't mock builtin methods. One approach I have often done is to change my code a bit to not use # mymodule.py def get_today(): return da...
@steve's is actually the most elegant way of doing it. For the "correct" way see the order keyword argument of numpy.ndarray.sort However, you'll need to view your array as an array with fields (a structured array). The "correct" way is quite ugly if you didn't initially define your array with fields... As a quick exam...
I'm looking for more guidance using the QGIS ComboBoxManager module (http://3nids.github.io/qgiscombomanager/). After finally getting the imports correct, I'm trudging my way through learning how to use it. I'm creating a simple plugin that utilizes three separate combo boxes to choose layers. Accepting the initial dia...
The ideal solution for this problem works with iterators (not just sequences). It should also be fast. This is the solution provided by the documentation for itertools: def grouper(n, iterable, fillvalue=None): #"grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx" args = [iter(iterable)] * n return itertools.izip_l...
python3 (143) or (124 with flickering) import time;from turtle import*;tracer(0) while 1:reset();ht();color("snow");a=time.strftime("#%H%M%S");write(a,0,"center");bgcolor(a);update() using turtles, 143 bytes, will probably not be the shortest, but I simply wanted to use play with turtles again. This example updates th...
In almost all 2D platformers I've played, your avatar always starts off on the left side of the world, and continues on to the right. Is there something designers gain by doing this? I'm not sure if there's any technical reason, but a large portion of the world reads from left to right (and many early games were made i...
I'm having some issues while displaying a 'Base64' encoded image in my AIR application. I'm fetching an image, which is 'Base64' encoded string, in a XML through a web service. At application side I'm able to decode it, but its not been able to display the image on the fly. A little search on Google gave me various res...
Sorry for the long question, but I couldn't find a better way to summarize it. I have a program which uses Python's multiprocessing to run some calculations in paralell. The communication between processes is done using two Queue objects, a work_queue and a result_queue.The main process fills up the work_queue with dat...
Pylades /* Topic des codeurs couche-tard [1] */ Bienvenue dans le TdCCT 0x1. Ceci est la suite de ce fil. Voici le rappel des règles du jeu, formulées par le message initial de samuncle : Bienvenue dans ce nouveau topic psychédélique, ou le but est de coder le plus tard possible (oui, c’est bien connu, il est plus faci...
jduv pb mises à jour Bonjour à tous, je débarque sous Kubuntu et même sous linux aprés un trés rapide passage chez mandriva. Donc j'ai installé Kubuntu depuis un cd télécharger en Juillet. L'installation semble s'être déroulée correctement au niveau matériel (dual boot avec Win XP pro) pas de soucis sauf un. Aprés le d...
I started the debugging session over by quitting with the (q)uit command, and restarted the debugger by kicking off the script again: (Pdb) q {'1': 2, '0': 1, '3': 4, '2': 3, '5': 6, '4': 5, '7': 8, '6': 7} **************************************** **************************************** line>> 1 2 3 4 {'1': 2, '0': 1,...
I'm beginning python and I'm trying to use a two-dimensional list, that I initially fill up with the same variable in every place. I came up with this: def initialize_twodlist(foo): twod_list = [] new = [] for i in range (0, 10): for j in range (0, 10): new.append(foo) twod_list....
import json import urllib import re import binascii def asciirepl(match): s = match.group() return binascii.unhexlify(s[2:]) query = 'google' p = urllib.urlopen('http://www.google.com/dictionary/json?callback=a&q='+query+'&sl=en&tl=en&restrict=pr,de&client=te') page = p.read()[2:-10] #As its returned as a func...
Using Django. One of my model has a DateProperty attribute which is set by default as date.today(). The GAE doco states that DateProperty fields are automatically converted to UTC times before being stored. After my object has been stored, i would like to convert back its date to Melbourne time and use that as a string...
EDIT: I am working on an performance sensitive case, which need to calculate sum or max of data with user defined checkpoints. Please refer to the demo code: from itertools import izip timestamp=[1,2,3,4,...]#len(timestamp)=N checkpoints=[1,3,5,7,..]#user defined data=([1,1,1,1,...], [2,2,2,2,...], ...)#len...
Le Sphenodon [Résolu] Python : Impossible d'installer le module random Bonjour, Je n'arrive pas à installer le module random de Python. En fait j'ai 2 problèmes potentiels : soit je me trompe dans le nom du module ce qui explique que je n'arrive pas à l'installer ; soit j'ai mal installé pip et ça ne marche pas. J'ai d...
The conventional splitcan't handle COBOL EBCDIC files because they don't have sensible \n line breaks. Translating an EBCDIC file to ASCII is high-risk because COMP and COMP-3 fields will be trashed by the translation. If the files include Occurs Depending On, then the FTP transferThere are two essential Python techniq...
pandas has the excellent .read_table() function, but huge files result in a MemoryError. Since I only need to load the lines that satisfy a certain condition, I'm looking for a way to only load those. This could be done using a temporary file: with open(hugeTdaFile) as huge: with open(hugeTdaFile + ".partial.tmp", ...
The JavaScript loaded by pinit.js builds five different widgets, not just the Pin It button. If it's interfering with AJAX submissions, please check that it's being loaded only once, at the bottom of your page. (I am the author of the code and would love to know more about how we're breaking your page; is there an URL ...
I have a very strange unexpected problem with Python 2.7.2 under Windows 7.. This code doesn't quit: import gtk import win32ui w = gtk.Window() w.connect("destroy", gtk.main_quit) w.show_all() gtk.main() print 'stop-point' quit() The window closes, I get 'stop point', and all should be ok.But console doesn't close.Eve...
The problem I'm having is with mixing serialized Django models using django.core.serializers with some other piece of data and then trying to serialize the entire thing using json.dumps. Example code: scores = [] for indicator in indicators: score_data = {} score_data["indicator"] = serializers.serialize("json...
I'm using Python and its MySQLdb module to import some measurement data into a Mysql database. The amount of data that we have is quite high (currently about ~250 MB of csv files and plenty of more to come). Currently I use cursor.execute(...) to import some metadata. This isn't problematic as there are only a few entr...
I am attempting to use Python3 to send metrics to Hosted Graphite. The examples given on the site are Python2, and I have successfully ported the TCP and UDP examples to Python3 (despite my inexperience, and have submitted the examples so the docs may be updated), however I have been unable to get the HTTP method to wo...
I get the error: TypeError: 'person' is an invalid keyword argument for this function My model is: class Investment(models.Model): company = models.ManyToManyField("Company", related_name ="Investments_company") financial_org = models.ManyToManyField("Financial_org", related_name ="Investments_financial_org") person =...
You can use Twisted to verify certificates. The main API is CertificateOptions, which can be provided as the contextFactory argument to various functions such as listenSSL and startTLS. Unfortunately, neither Python nor Twisted comes with a the pile of CA certificates required to actually do HTTPS validation, nor the H...
I have been going crazy trying to make this work. I want to collect a telnet log from python. On plain telnet I would just open telnet and use: set logfile test.xml The problem is that with python I cannot figure out how to pass this command first. when I run this try: tn = telnetlib.Telnet() tn.write(b"set log...
Module symbol Non-terminal symbols of Python grammar (from "graminit.h"). single_input = 256 file_input = 257 eval_input = 258 decorator = 259 decorators = 260 funcdef = 261 parameters = 262 varargslist = 263 fpdef = 264 fplist = 265 stmt = 266 simple_stmt = 267 small_stmt = 268 expr_stmt = 269 augassign = 270 print_st...
All web frameworks need to generate HTML pages so they all include a template language to describe the content of these pages. The template language describes how to render data (in the form of XML or a Python dictionary for example) into HTML. All template languages consist of HTML text embedding code delimited by spe...
Help! I am a non-GUI programmer who is trying to write a simple (!) program using wxPython. I have read everything I can online, but my overall lack of GUI experience is presumably causing me to not see the problem. In a nutshell, I want to have a window with a wxNotebook with several tabs. Each tab, of course, will ha...
I'm trying to get first frame and keep it unchanged but it changes after every assignment to the other variable ( currImage = cv.QueryFrame(capture) ). What am I doing wrong? #!/usr/bin/env python # -*- coding: utf-8 -*- import cv cv.NamedWindow("w1", cv.CV_WINDOW_AUTOSIZE) #SET CAMERA INDEX BELOW camera_index = -1 ...