text
stringlengths
256
65.5k
I'm having trouble with tastypie and posting data to it. I only am able to retrieve a 401 error code. For clarification, I am able to successfully retrieve data from the tastypie api. Attached are the code snippets, and maybe someone can help me out get behind this. Before I get started, a little background: I am using...
The multiprocessing module in Python 3.2.1 on Windows 7 x86 seems to be defeating me. I have two modules: servmain.py and sslserver.py. The idea is to (eventually) code an application which will communicate with clients using SSL. This is the part I already have down. However, I need the server listener to be spun off ...
I also use Python 'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.' 'God exists because Mathematics is consistent, and the devil exists because we cannot prove it' 'Humanity is still kept intact. It remains within.' -Alokananda Offline Yeah, I'm currentl...
The problem that i am having is my python shell restarts as it starts executing SetupUi() class Ui_MainWindow(object): def __init__(self): print "control" self.setupUi() def setupUi(self): print "control" MainWindow=QtGui.QMainWindow() print "control" MainWindow.setObjectName(_...
I'm trying to make a text-based game in Python, however, code could get out of hand pretty quickly if I can't do one thing on one line. First, the source code: from sys import exit prompt = "> " inventory = [] def menu(): while True: print "Enter \"start game\" to start playing." print "Enter \"pass...
Yes, that's right. Guido rejected the idea for a built-in prod() function because he thought it was rarely needed. As you suggested, it is not hard to make your own using reduce() and operator.mul(): def prod(iterable): return reduce(operator.mul, iterable, 1) >>> prod(range(1, 5)) 24 In Python 3, the reduce() fun...
Edit: Seems I made a mistake on my previous description and example so here it is fixed. Latest Version interactions = [ ['O1', 'O3'], ['O2', 'O5'], ['O8', 'O10'] ['P3', 'P5'], ['P2', 'P19'], ['P1', 'P6'] ] So same as before, each entry is an interaction between two parts of an object. For example think of O and P as o...
I don't have an Outlook installation available to test this, so I'm wondering about the reason for the fifth line in your function. self.msg.content_subtype = "html" I don't know much about multipart email internals, but on my system that line causes both parts of the message have a content-type of text/html. Leaving i...
Documentation revised 01/10/09 by Dennis German again and again.. MHDD project MHDD MHDD package contents Using MHDD Commands are listed here from simplest to most dangerous ID, [F2], EID, shift[F2], shift[F3] F8 MAKELOG or SCAN F4AMM PWD, LOCK, UNLOCK, DisablePassword ERASE RHPA HPA NHPA. TO a File, ATOF FF , CONFIGF5...
I have the following code for showing some images: HTML: <div class="footer-logos"> <ul> <li><img src="/sites/default/files/imagefield_thumbs/All Ears Cambodia Logo_1.png" alt="" class="first"></li> <li><img src="/sites/default/files/imagefield_thumbs/MLF rev.jpg" alt="" class=""></li> ...
If you want to do it without win32api, you can use the built-in ctypes module. I usually run CPython without win32api, so I kinda like these solutions. It's a tiny bit more work for GetSystemPowerStatus() because you have to define the SYSTEM_POWER_STATUS structure, but not bad. # Get power status of the system using c...
gtk.Alignment — a widget that controls the alignment and size of its child class gtk.Alignment(gtk.Bin): gtk.Alignment(xalign=0.0, yalign=0.0, xscale=0.0, yscale=0.0) def set(xalign, yalign, xscale, yscale) def set_padding(padding_top, padding_bottom, padding_left, padding_right) def get_padding() +--g...
Download FREE PDF JavaFX is an exciting new platform for building Rich Internet Applications with graphics, animation, and media. It is built on Java technology, so it is interoperable with existing Java libraries, and is designed to be portable across different embedded devices including mobile phones and set-top boxe...
cmarcx Re : [Script] Client Hubic pour linux ;) Bonjour, J'ai essayé de monter hubic avec la commande : ./hubicmount -l <email> -p <passwd> -o umask=022 -o uid=1000 /media/hubic Mais j'obtiens toujours l'erreur "Unable to login to hubic". Pourtant les logins indiqués sont bons, je fais un copier-coller, et ils fonction...
I want to make admin add-form dynamic. I want to add few formfields depending on setting in related object. I have something like this: class ClassifiedsAdminForm(forms.ModelForm): def __init__(self,*args, **kwargs): super(ClassifiedsAdminForm, self).__init__(*args, **kwargs) self.fields['testujemy'] = form...
Unknown error while trying to update my code to GAE server. I tried to search something similar to this but google couldn't help me out on this. I was able to update my code one or two days ago. Below is the full error message. $ appcfg.py update /dir/to/my/app 12:38 PM Host: appengine.google.com 12:38 PM Application: ...
ubuntiny [Résolu] Problème avec arista Salut à tous! Voilà le problème: j'ai essayé d'installer arista, un encodeur permettant de manipuler les vidéos (encodage, modification du format de lecture etc...), mais après installation, lorsque je clique sur le raccourci arista situé dans le menu applications de gnome, ou lor...
I thought this must be easy but I really have troubles figuring it out: I'd like to check for an acquired permission of a role on an object. I don't want to check for the actual user's roles or permissions, I just want to check i.e. if on an object Anonymous has the permission 'Access contents information'. This is eas...
Please choose @ZackBloom's answer as the correct one, he intuited it right off, without even knowing pyparsing's syntax. Just a few comments/suggestions on your grammar: With the answer posted above, you can visualize the nesting using pprint and pyparsing's asList() method on ParseResults: res = scope.parseString(vcd)...
I have some problem with matrix multiplication: I want to multiplicate for example a and b: a=array([1,3]) # a is random and is array!!! (I have no impact on that) # there is a just for example what I want to do... b=[[[1], [2]], #b is also ra...
I am new to both python, and to threads. I have written python code which acts as a web crawler and searches sites for a specific keyword. My question is, how can I use threads to run three different instances of my class at the same time. When one of the instances finds the keyword, all three must close and stop crawl...
I'm using the Python based Social Cookbook template to create a Facebook App, but I'm having a problem with Canvas support which does a POST instead of a GET. The Cookbook example doesn't include how to handle this. Based on reading this Hello World example and looking at the Run With Friends example, I'm able to get t...
How do i format 1000000 to 1.000.000 in Python? If you want to add a thousands separator, you can write: >>> '{0:,}'.format(1000000) '1,000,000' But it only works in Python 2.7 and higher. See format string syntax. In older versions, you can use locale.format(): >>> import locale >>> locale.setlocale(locale.LC_ALL, ''...
This is the entire code basically logging in and scraping the data off google analytics. The issue surrounds the date loop. It will not loop around results and in this case it says ERROR: Traceback (most recent call last): File "C:/Python27/GOOGLE ANALYTICS/Data Extraction Life Plan V0.4 TEST.py", line 147, in <modul...
I am sure this has been answered, but the query is a bit too complex for google. In short, I am trying to delete many deprecated methods from some code. So I am skimming the file and when I see a method that I want to remove, I am deleting every line until I see a line that starts with a tab then the string "def". I am...
I have read many answers here but none did answer my exact question. I did the part one, the polls. I started part 2, the admin, however, after runserve, when i try to acces the page, here is the error i get (my project name is john): Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/ Using...
loic_e Kubuntu Dapper sur Sony VAIO VGN-FE28H Voici la procédure d'installation utilisée pour installer Kubuntu Dapper sur un Vaio VGN-FE28H: Caractéristiques: Processeur Intel Core Duo Fréquence 1.67 GHz Quantité de RAM 1 Go Type de RAM DDR2-SDRAM Disque dur 160 Go Puce graphique nVIDIA GeForce 7400 Turbo Cache Taille...
I did everything specified in the documentation of app engine but i couldn't get the blobstore work. Maybe some of you can detect what i am doing wrong. When i clicked the submit button This kind of a url is seen in the address bar and an empty white page is in front of me. http://localhost:8080/_ah/upload/agltb2JpbHNv...
I've built a python dictionary as follows: result = {} for fc in arcpy.ListFeatureClasses(): for field in arcpy.ListFields(fc): result.setdefault(field.name, []).append(fc) which takes the name of the fields in each table (feature class) and sets tyhem as the key value in the dictionary and goes on to set ...
Description: Gensim - Python Framework for Vector Space Modelling Gensim is a Python library for Vector Space Modellingwith very large corpora. Target audience is theNatural Language Processing(NLP) community. Features all algorithms are memory-independentw.r.t. the corpus size (can process input larger than RAM) simpl...
Trying to use pil for creating grid-like layout from images. But that code only draws first column. Can anyone help me? def draw(self): image=Image.new("RGB",((IMAGE_SIZE[0]+40)*5+40,(IMAGE_SIZE[1]+20)*CHILD_COUNT+20),(255,255,255)) paste_x=(-1)*IMAGE_SIZE[0] paste_y=(-1)*IMAGE_SIZE[1] i=0 for a ran...
I've reviewed all the questions here about this, reviewed the bottle tutorial, reviewed the bottle google group discussions, and AFAIK, I'm doing everything right. Somehow, though, I can't get my CSS file to load properly. I'm getting a 404 on the static file, that http://localhost:8888/todo/static/style.css is not fou...
I'm trying to write a script in Python that reloads a page every x seconds using a list of proxies, and I'm having an issue at the moment. I know it's not the proxies' faults either, because I can ping them and they return fine. They are HTTP proxies. My script returns this error to me: urllib.error.URLError: <urlopen ...
I am new to python and learning pandas. I want to convert a pandas data frame "datframe" to an R-style data frame (to use rpy2 later). To this end I have the following two lines in my code: import pandas.rpy.common as com r_dataframe = com.convert_to_r_dataframe(datframe) The first command goes through but then I ge...
I'm just going to put it out there that it's always better to ask for forgiveness than to ask permission. This is a python best practice, which may not be relevant to you as a beginning programmer, but it's good to get started on the right foot. try just says "try to do the following stuff" and except says "if there wa...
johnatan57950 Re : [tuto]Installation de Dofus 2.0 par paquet debian et rpm (pour la doc) bj quand je clique sur l'icone dofus je suis venue a telcharger dofus mise a jours et tout le reste et une fois fini je clique sur jouer et sa me met adobe air L'installation de cette application est endommagée. Essayez de la réin...
Last week, I covered the Basics of the OAuth 2.0 Authorization Flow. Today, I will walk through how we used pyoauth2 to set up a minimal Authorization Provider for SHIFT. This post covers setting up endpoints for steps 2 and 5 from the overview. The role of the Authorization Provider is to securely generate, validate, ...
When I'm working with python, I usually have two terminal windows open - one with IPython, and the other with a fairly customized Vim. Two good resources: Though it sounds like what you want is IPython's magic function %ed/%edit: An example of what you can do: In [72]: %ed IPython will make a temporary file named: c:\d...
Bybeu [résolu] Problème veille carte nvidia 4200 nvidia96 EDIT 27 mars 2013: j'ouvre un nouveau fil ici: http://forum.ubuntu-fr.org/viewtopic.php?id=1210781 Bonjour Mon portable 12.04 plante en sortie de veille; J'ai essayé sudo s2ram -n Machine matched entry 222: sys_vendor = 'Dell Computer Corporation' sys_...
I'd like to grab daily sunrise/sunset times from a web site. Is it possible to scrape web content with Python? what are the modules used? Is there any tutorial available? Just use urllib2 in combination with the brilliant BeautifulSoup library: import urllib2 from BeautifulSoup import BeautifulSoup # or if you're using...
Here's how I resolved the problem step-by-step. Even after several years of experience with regexp, some particular syntaxes always escapes my mind. At such times, it's best to start with a short expression which absolutely should match what you want. Let's use the re module. >>> import re Now what is the error? >>> r...
toma222 [HOW TO] adesklets : configuration des desklets Il existe désormais un article sur le wiki concernant Adesklets donc je vous conseille de vous y fier, ce tutoriel n'étant plus mis à jour. J'ouvre ce deuxième post au sujet de adesklets, afin de permettre une meilleure lisibilité de l'ensemble.Celui-ci a donc pou...
I need to save an uploaded file before super() method is called. It should be saved, because i use some external utils for converting a file to a needed internal format. The code below produce an error while uploading file '123': OSError: [Errno 36] File name too long: '/var/www/prj/venv/converted/usermedia/-1/uploads/...
I have a dataframe of historical stock trades. The frame has columns like ['ticker', 'date', 'cusip', 'profit', 'security_type']. Initially: trades['cusip'] = np.nantrades['security_type'] = np.nan I have historical config files that I can load into frames that have columns like ['ticker', 'cusip', 'date', 'name', 'sec...
Short answer, no, you have to create your own function. Long answer: its not pythonic to do what you're asking. There might be some special cases (e.g, marshalling a dict to xmlrpc), but by and large, assume the objects will act like what they're documented to be. If they don't, let the AttributeError bubble up. If you...
I am playing around with gevent, and I am trying to understand why my code is blocking and how I can fix it. I have a pool of greenlets, and each of them talk to a thrift client which gathers data from a remote thrift server. For the purpose of the exercise, the thrift server always take > 1s to return any data.When I ...
(Django 1.1) I have a Project model that keeps track of its members using a m2m field. It looks like this: class Project(models.Model): members = models.ManyToManyField(User) sales_rep = models.ForeignKey(User) sales_mgr = models.ForeignKey(User) project_mgr = models.ForeignKey(User) ... (more FK us...
This is what I ended up doing. The suggestion to use the IMAP service is absolutely correct. The trick is not to pull in all your mail, but use the features of IMAP to retrieve only the information you are interested in. In our case, that is the "Delivered-to:" header.The entire process only takes a few minutes on a fu...
I seem to be getting an IOError: request data read error quite a lot when i'm doing an Ajax upload. For example out of every 5 file uploads it errors out on atleast 3. Other people seem to have had the same issue. Eg. http://stackoverflow.com/questions/2641665/django-upload-failing-on-request-data-read-error http://sta...
An OBEX client class. (Note this is not available on Python for Series 60.) For example, to connect to an OBEX server and send a file: >>> import lightblue >>> client = lightblue.obex.OBEXClient("aa:bb:cc:dd:ee:ff", 10) >>> client.connect() <OBEXResponse reason='OK' code=0x20 (0xa0) head...
serial [Résolu] Pb de lag pour la vidéo et le son, disque dur lent Dans un premier temps, j'ai du son (multiplexé via alsa), jusqu'ici pas de problème. Dès que je lis une vidéo, elle rame et le son saute, surtout quand nautilus cherche à créer les vignettes, qu'il n'arrive pas à faire d'ailleurs. Petite précision, sous...
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...
My question is: How far can you go? In the interests of not creating code that is an unreadable morass of punctuation, I'm going to risk the downvotes and answer a different, though very much related, question: how far should you go? Regular expression parsers are a brilliant thing to have in your toolkit but they are ...
Hizoka encore du sed et awk Bonjour ! Je viens vers vous pour demander un peu d'aide... Voici un exemple de fichier sur lequel je travaille : poupou (0.0.1~ppa1~precise) precise; urgency=low () * blublu de bugs * blabla -- Belleguic Terence <hizo@free.fr> Fri, 12 Oct 2012 06:39:46 +0200 poupou (0.0.0~ppa1~precise...
I am building an application that will do the following: post XML to an HTTP address take the response and store it in a table on a remote mssql db post the XML again and compare the response to what was previously stored in the database look for certain differences, and when they are present, post XML to an HTTP addre...
I'm trying to port an app I've been running locally to GAE. The app uses the Bottle.py framework. I use Beaker for session management. I'm a bit of a noob and am having trouble getting Beaker imported properly. Help greatly appreciated. I'm running the ported app using GoogleAppEngineLauncher.app under Mac OS X 10.6.7....
I am new to python and I have a question about a piece of python code that creates a cleaned up output file from a model output file. This code was written for a Mac user, but now I want to run it in Windows. But it gives an error message. Could you help me in converting this code so I can use it in Windows? Thanks. im...
Previously I posted a proposal for a safe self-improving limited oracle AI but I've fleshed out the idea a bit more now. Disclaimer: don't try this at home. I don't see any catastrophic flaws in this but that doesn't mean that none exist. This framework is meant to safely create an AI that solves verifiable optimizatio...
I came across a problem that I can't solve and it's associated with multiprocessing and use it inside the decorator. When I'm calling the method run_in_parallels using multiprocessing I 'm getting the error: Can't pickle <function run_testcase at 0x00000000027789C8>: it's not found as __main__.run_testcase The call tak...
In preparation for a session at useR!2012 on "What other languages should R users know about?", Dirk, Chris Fonnesbeck and I have considered implementations of this simple sampler in other languages. I describe a Julia implementation below. Full details on all of the implementations are available at Chris's github repo...
#2676 Le 15/02/2013, à 19:14 mulder29 Re : TVDownloader: télécharger les médias du net ! Et je reçois python: can't open file alors que j'ai installé Python 2.7.3, hier. Hors ligne #2677 Le 15/02/2013, à 19:26 k3c Re : TVDownloader: télécharger les médias du net ! si tu tapes which python ça affiche quoi ? Dernière mod...
I have the following case: class MyClass (object): @property def _value(self): return self.value * 5 mapper(MyClass, myTableMetadata, properties = { "value": synonym("_value", map_column=False) }) I'm completely aware why this is leading to recursion, but is there a way from the class to access the...
e.g. if you have code that does something like this somewhere in your codebase: >>> import logging >>> logging.basicConfig() >>> logger = logging.getLogger(__name__) >>> logger.critical("foo: %s", 1, 2) Traceback (most recent call last): File "/pluto/local/lib/python2.6/logging/__init__.py", line 768, in emit msg...
nam1962 [résolu, du coup tuto] Comment nettoyer mauvaise install de langues Comment peut on récupérer un desktop en francais sous 12.04 ou 12.10 ? Je viens d'installer un Airis pour un ami en Xubuntu 12.04 Tout est total ok, mais le desktop est en anglais (tous les fichiers locale indique pourtant fr_Fr ou fr UTF8). Y ...
Back to cookbook Normally it's easier to use librsvg Python bindings from PyGTK, so you can import rsvg. When that's not an option, you may be able to bind just enough of it using the ctypes module to use it. Example for win32 follows. # Very primitive librsvg bindings for win32 # no error checking, etc. # but hey it w...
ljere Re : Live Voyager 12.10 merci pour les précisions c'est vraiment cool je plains rodofr si il veut intégrer tout ça Hors ligne metalux Re : Live Voyager 12.10 Le repos aura été de courte durée, qu'est-ce qu'on peut dire des C.....quand on a un coup de barre! Quelqu'un a testé ce que j'ai exposé au post #314? De mo...
This is a follow-up to Handle an exception thrown in a generator and discusses a more general problem. I have a function that reads data in different formats. All formats are line- or record-oriented and for each format there's a dedicated parsing function, implemented as a generator. So the main reading function gets ...
I'm trying to do some telnet automation with Python (only pure Python). When I try to print some of my read's in the function read_until, all I see are a series of bs's -- that's bs, as in the backspace character, not something else. :-) Does anyone know if there's some kind of setting I can change in the on tn, my ins...
Topic: still having problems with viewing quarantined emails ==== Required information ==== - iRedMail version: - Store mail accounts in which backend (LDAP/MySQL/PGSQL): - Linux/BSD distribution name and version: - Related log if you're reporting an issue: ======== Required information ==== - iRedMail version: 0.8.6 -...
Installazione Prima di installare web.py dobbiamo scaricare i sorgenti: http://webpy.org/static/web.py-0.33.tar.gz estraiamolo e copiamo la cartella "web" in una directory dove risiede la nostra applicazione.Se invece vogliamo rendere web.py accessibile a tutte le applicazioni, dobbiamo installarlo in modo che sia rep...
I've been parsing some docx files (UTF-8 encoded XML) with special characters (Czech alphabet). When I try to output to stdout, everything goes smoothly, but I'm unable to output data to the file, Traceback (most recent call last): File "./test.py", line 360, in ofile.write(u'\t\t\t\t\t\n') UnicodeEncodeError: 'ascii' ...
Adobe Flash Professional version MX and higher Adobe Flex This technique relates to: The objective of this technique is to show how non-text objects in Flash can be marked so that they can be read by assistive technology. The Flash Player supports text alternatives to non-text objects using the name property in the acc...
#0 -1 » Lancement JDownloader » Le 14/11/2009, à 10:59 jouclar Réponses : 3 Bonjour à tous, N'ayant pas trouvé de réponse à mon problème de démarrage avec JDowloader je me lance. Alors voilà : J'ai installé JAVA 6 via Synaptic J'ai téléchargé JDownloader via http://jdownloader.org/download/index Puis décompressé l'arch...
JavaScript stevenhu — 2012-09-21T16:02:46-04:00 — #1 I am trying to delete a row in a database via external JS, but don't think the syntax is right. What I have right now is my best guess as to what it should be. The database rows show an ID, filename, and title (context: a bookmarked or favorite page), and when a quer...
In Python/Google app engine, I'd like to store a property as a key name in order to save resources and speed things up. But I don't know how to get the list of key names. As an example, consider the data model: class Book(db.Model): isbn = db.StringProperty() # Make this a key name instead. category = db.String...
I had a programming interview recently, a phone-screen in which we used a collaborative text editor. I was asked to implement a certain API, and chose to do so in Python. Abstracting away the problem statement, let’s say I needed a class whose instances stored some data and some other_data. I took a deep breath and sta...
Any real-world, enterprise-scale application requires access to some sort of persistent storage. The Relational Database Management System (RDBMS) is the most widely-used persistence storage mechanism that supports SQL for data query and update. Java DataBase Connectivity (JDBC) is a set of APIs that provide a framewor...
Up and flying with the AR.Drone and ROS: Handling feedback This is the third tutorial in the Up and flying with the AR.Drone and ROS series. In this tutorial we will: Learn about the AR.Drone’s state feedback (and how it is handled by ROS) Learn about the AR.Drone’s tag detection Program our first ROS nodes: A subscrib...
Asynchronous Programming in Python Twisted is pretty good. It sits as one of the top networking libraries in Python, and with good reason. It is properly asynchronous, flexible, and mature. But it also has some pretty serious flaws that make it harder than necessary for programmers to use. This hinders adoption of Twis...
I am looking for a more efficient way to do comparisons between all elements of a python dict. Here is psuedocode of what I am doing: for key1 in dict: for key2 in dict: if not key1 == key2: compare(key1,key2) if the length of the dict is N, this is N^2 - N. Is there any way of not repeating th...
I am able to understand preorder traversal without using recursion, but I'm having a hard time with inorder traversal. I just don't seem to get it, perhaps, because I haven't understood the inner working of recursion. This is what I've tried so far: def traverseInorder(node): lifo = Lifo() lifo.push(node) w...
For the first plot, I recommend axisartist. The automatic scaling of the two y-axis on the left-hand-side is achieved through a simple scaling factor that applies to the specified y-limits. This first example is based on the explanations on parasite axes: import numpy as np from mpl_toolkits.axes_grid1 import host_subp...
Ruby how to download a file if the url is a redirection? i'm trying to download this url: soundcloud.com/stereo-f---/cohete-amigo/download the redirection is this: [ec-media.soundcloud.com/HNIGsuMJlDhy?ff61182e3c2ecefa438cd0210ad0e38569b9775ddc9e06b3c362a686319250ea5c1ae2d33d8d525807641f258e33de3cb0e559c1b591b5b00fb32d...
The decode method of unicode strings really doesn't have any applications at all (unless you have some non-text data in a unicode string for some reason -- see below). It is mainly there for historical reasons, i think. In Python 3 it is completely gone. unicode().decode() will perform an implicit encoding of s using t...
One of the finest features of the Python language are the list comprehension and it's lazy brother, the generator expression. The family has grown in Python 3 to include the equally useful dictionary and set comprehensions. They all sport a readable and intuitive syntax, but some patterns may be surprising for beginner...
About virtualenv Combine virtualenv with IPython Proof by trial Conlcusion Packages and version About virtualenv I recently got introduced to virtualenv: a “tool to create isolated Python evironments”. It allows to have a fine grain control on the dependencies of each of your python project, and separate each project e...
When using the Python string function split(), does anybody have a nifty trick to treat items surrounded by double-quotes as a non-splitting word? Say I want to split only on white space and I have this: >>> myStr = 'A B\t"C" DE "FE"\t\t"GH I JK L" "" ""\t"O P Q" R' >>> myStr.split() ['A', 'B', '"C"', 'DE', '"FE"', '...
I'll post my code first, and then ask questions. def menu(**arg): if len(arg) == 0: name = raw_input("Enter your name: ") location = raw_input("Enter your name: ") else: for i,j in arg.items(): globals()[i] = j print "Name: %s | Location: %s" % (name, location) The goal ...
I mentioned in my last post how useful Ben Welsh's code recipe's are. Count this post as my effort to encourage the practice among coding journalists. Since launching the NewsHour's Annotated State of the Union, I've gotten a few questions about how it worked, particularly about linking comments to paragraphs. What's n...
Asynchronous Programming in Python Twisted is pretty good. It sits as one of the top networking libraries in Python, and with good reason. It is properly asynchronous, flexible, and mature. But it also has some pretty serious flaws that make it harder than necessary for programmers to use. This hinders adoption of Twis...
I'm trying to write a Python script that will crawl through a directory and find all files that are duplicates and report back the duplicates. What's the best was to solve this? import os, sys def crawlDirectories(directoryToCrawl): crawledDirectory = [os.path.join(path, subname) for path, dirnames, filenames in os...
I'd like to split a string using one or more separator characters. E.g. "a b.c", split on " " and "." would give the list ["a", "b", "c"]. At the moment, I can't see anything in the standard library to do this, and my own attempts are a bit clumsy. E.g. def my_split(string, split_chars): if isinstance(string_L, bas...
doudoulolita Faire une animation sur la création de jeux vidéo libres Dans le topic Création de jeu vidéo libre - Appel à candidatures, j'ai découvert le créateur de jeu de Ultimate Smash Friends, Tshirtman. Voici ce que je lui ai écrit: Je cherche un jeu que notre Espace Public Numérique pourrait proposer aux jeunes s...
Etoma Re : /* Topic des codeurs [7] */ Écrire du code est très exigeant. C'est plaisant. Hors ligne tshirtman Re : /* Topic des codeurs [7] */ si les experts d'haskell peuvent l'aider… (j'aime bien ce gars… c'est le mec qui code git-annex et upload des paquets debian depuis un netbook tournant à l'énergie solaire dans ...
I wrote a spider, that worked brilliantly the first time. The second time I tried to run it, it didn't venture beyond the start_urls. I tried to fetch the url in scrapy shell and create a HtmlXPathSelector object from the returned response. That is when I got the error So the steps were: ` [scrapy shell] fetch('http://...
Mathieu11 [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...) Edit admin : le sommaire renvoyant vers les différents scripts se trouve désormais sur cette page de la documentation. Les nouveaux scripts peuvent donc être discutés ici, puis inclus dans le sommaire J'ouvre ce sujet pour proposer a chacun de pos...
cocoubuntu [Resolu]duplicate sources.lits Aprés un téléchargement de paquets , j'ai eu le message suivant : " W : duplicate sources.list entry http://fr archive.ubuntu.com breezy/universe.Packages(/var/lib/apt/list/fr.archive.ubuntu.com_ubuntu_dists_breezy_universe_binary-i386_Packages) J'ai édité la sources.list ....s...
Ayu Grub ne se lance pas Bonsoir, J'ai installé windows 7 et Xubuntu 11.10 sur un nouveau pc avec cette configuration:CM: Asus P8H67 B3Processeur: i5 2500kDD: 1TO 7200 RPMRAM: 2x4GOCG: Gigabyte GeForce GTX 560 Mais je boot toujours sur windows et Grub ne se lance pas j'ai essayé de réinstaller grub depuis une session l...
I have the following datastore model: class FeatureCategory(db.Model): name_eng = db.StringProperty(required=True) name_spa = db.StringProperty() name_por = db.StringProperty() device_type = db.ReferenceProperty(DeviceType, required=True, collection_name='feature_categories') class Feature(db.Model): ...
Maybe a bit of example code will help: Notice the difference in the call signatures of class A(object): def foo(self,x): print "executing foo(%s,%s)"%(self,x) @classmethod def class_foo(cls,x): print "executing class_foo(%s,%s)"%(cls,x) @staticmethod def static_foo(x): print ...