text
stringlengths
256
65.5k
I've been trying to scrape data from a website and write out the data that I find to a file. More than 90% of the time, I don't run into Unicode errors but when the data has the following characters such as "Burger King®, Hans Café", it doesn't like writing that into the file so my error handling prints it to the scr...
Working with Ubuntu 12.04 headless server Python v2.7.3 Django v1.3.1 FINAL Python came preloaded, I installed django from apt-get python-django I will note that I have setup and configured 2 servers for development use. Both for the practice and because I travel a lot and having a VM handy is always nice. However, thi...
Edited :-) Hopefully a bit clearer now. The logic is of the model is: A Buildinghas manyRooms A Roommay be inside anotherRoom(a closet, for instance--ForeignKey on 'self') A Roomcan only be inside anotherRoomin the same building (this is the tricky part) Here's the code I have: #spaces/models.py from django.db import m...
(I asked this question in stackoverflow.com, but I am now thinking my mistake may be mathematical rather than programming). I am simulating geometric brownian motion, using closed-form solution for the value after an arbitrary (not necessarily infinitesimal) step dt. My drift = 0, standard deviation = 1, initial value ...
ok, since it seems not possible, I put together a proto-plugin for gedit2 that works for me at the moment. I still hope that someone has a better answer... ~/.gnome2/gedit/plugins/mimeprefs.py import gedit class MimePrefsPlugin(gedit.Plugin): def __init__(self): gedit.Plugin.__init__(self) def activate(...
I recently noticed that in ubuntu unity the application indicator (which replaces the system tray) does not show the custom icons I added to the gtk stock, but only the basic stock icons. In place of the correct icons I see "gtk-missing-image". On my apps toolbars and menus those icons are displayed properly, the probl...
I have inherited a new class named ModelAdminWithInline from admin.ModelAdmin and modified methods add_view(...) and change_view(...) to call function is_cross_valid(self, form, formsets), where you can validate all the forms together.Both functions had: #... if all_valid(formsets) and form_validated: #... changed to:...
If a site uses .htaccess file to rewrite the URL for e.g. better SEO. Is it possible to find out what is the "real" URL? This is not possible unless you know the rewrite rule. In some cases direct access the "real" file is forbidden entirely. Other than that you could try using DirBuster with a custom directory list, s...
#8526 Le 21/02/2013, à 22:33 The Uploader Re : Topic des Couche-Tard (cinquante-sept) Pas chez moi. Passer de Ubuntu 10.04 à Xubuntu 12.04 LTS ASUS N56VV (UEFI + GPT, Core i5-3230M @ 2.60GHz, Intel HD4000 + GeForce 750M, 12 Go de RAM, SSD 1 To) Système principal : Archlinux (amd64), avec KDE Système oublié la plupart d...
This is a minimal crash-course in the programming language Python. To learn more, take a look at the documentation at the Python web site, www.python.org; especially the tutorial. If you wonder why you should be interested, check out the comparison page where Python is compared to other languages. This introduction has...
I'm not sure what you're trying to do. Python is a very dynamic language; you don't usually need to declare variables until you're actually going to assign to or use them. I think what you want to do is just foo = None which will assign the value None to the variable foo. EDIT: What you really seem to want to do is ju...
I'm having problems on updating Ubuntu 11.10 to 12.04, I've tried to update all possible ways. I'v downloaded Ubuntu 12.04 from cd...but when booting the upgrade option wont appear...just: Install alongside-Erase disk and Install-Other. So after waiting 5 days I thought that be enough to update the mirror for my contry...
I'm using 'login' option in my app.yaml configuration file for a GAE application. Looks like this: - url: /admin/.* script: myapp.app login: admin- url: /.* script: myapp.app login: required UPDATE (by suggestion of bossylobster): I want a user always signed in (unsigned users can't do anything), and I need to know who...
Python has tons of cool idioms and features that are often overlooked or underutilized. List comprehensions to cut back on the use of unnecessary loops, decorators to wrap functions with annotations, and generator functions are just some that can be applied to working with the DFP API. In this post, we'll tackle one of...
Most of the time, code that we write doesn't have to perform as fast as if we wrote it in C. Most of the time, the first pass at writing it is "fast enough" and we don't have to optimize--but there are times when a piece of code just has to meet a certain standard of performance. For those "it's gotta run like a scalde...
After the interesting Mythbusters episode on the problem, I wrote a bit of Python code to simulate the results for fun. The code can be simplified considerably by breaking it into two trials, one where you always stay with your choice, and the other where you always swap. A further simplification can be had with the fo...
Currently in trunk only - will be in web2py 1.55: You can now export and import the entire database in CSV: db.export_to_csv_file(open('filename.csv','w')) for table in db.tables: db[table].truncate() db.import_from_csv_file(open('filename.csv','r')) The CSV contains all tables. Notice that upon import, the imported r...
gtk.ListStore — a list model to use with a gtk.TreeView class gtk.ListStore(gobject.GObject, gtk.TreeModel, gtk.TreeDragSource, gtk.TreeDragDest, gtk.TreeSortable): gtk.ListStore(column_type, ...) def set_column_types(type, ...) def set_value(iter, column, value) def set(iter, column_num, value, ...) ...
In Python, the only way I can find to concatenate two lists is list.extend, which modifies the first list. Is there any concatenation function that returns its result without modifying its arguments? Yes: Depending on how you're going to use it once it's created >>> import itertools >>> a = [1, 2, 3] >>> b = [4, 5, 6] ...
I am trying to create a "map of a city" using pygame. I want to be able to put images of buildings in specific grid coords rather than just filling them in with a color. This is how I am creating this map grid: def clear(): for r in range(rows): for c in range(rows): if r%3 == 1 and c%3 == 1: ...
I have the following code in django.template: class Template(object): def __init__(self, template_string, origin=None, name='<Unknown Template>'): try: template_string = smart_unicode(template_string) except UnicodeDecodeError: raise TemplateEncodingError("Templates can only ...
Which Python framework is best for web development in Google App Engine? webapp is the framework which is bundled with google app engine. The webapp framework is already installed in the app engine environment and in the SDK, so you do not need to bundle it with your application code to use it. Besides webapp, app engi...
PEP 08 states: Imports are always put at the top of the file, just after any module comments and docstrings, and before module globals and constants. However if the class/method/function that I am importing is only used in rare cases, surely it is more efficient to do the import when it is needed? Isn't this: class Som...
Raspberry Pi The First Step 0 The First Step For this first step, we will introduce the basic functionality provided by the library, and then we will read and write pixel values. For these tutorials I will use 'nano' as a text editor, though you may use whichever text editor you are most comfortable with. These example...
We've recently upgraded from Oracle 10gR2 (10.2.0.4 ) to 11gR2 (11.2.0.3) and we are noticing a significant hit in performance although execution plans are the same for the offended queries before and after the upgrade. Allocation of more memory did improve the performance but just slightly. We also tried to set optimi...
Leo 7 Résolu[polices] Chiffres à la place des lettres Salut à tous ! Voici mon pb: Ça me le fait qu'avec gnumeric et pantheon. Quelqu'un peut il m'aider ? mercu d'avance La police c'est ClearlyU Alternate Glyphs. Voici le résultat de la commande locale: [leo@HP-625 ~]$ locale LANG=fr_FR.utf8 LC_CTYPE="fr_FR.utf8" LC_NU...
chaoswizard Re : TVDownloader: télécharger les médias du net ! Une idée ca pourrait sympas aussi de récupérer a partir de daylimotion ou youtube : vous savez genre des chaines de groupe : http://www.youtube.com/user/ProdigyChannel exemple france inter : http://www.dailymotion.com/franceinter C'est jouable. Dans ce cas ...
I'm working a small program that calculates the trajectory of an object fired on certain planetary bodies, then plots them with Turtle graphics. Currently, I'm stuck on an issue with a Type Error that I can't seem to figure out. So, here is the stack: Traceback (most recent call last): File "MY FILEPATH", line 174, in ...
Trying to create an object with get_or_create(). The response hits, but it never successfully creates the object. Python code: class Note(models.Model): user = models.ForeignKey(User) topic = models.CharField(max_length=500, null=True, blank=True) created = models.DateTimeField(auto_now_add=True) co...
I run the following code under Mac OS X 10.6.8, wxPython 2.9.3.1 and 64 Bit Python v2.7.2: import wx class MyFrame(wx.Frame): def __init__(self): super(MyFrame,self).__init__(None, title="Frame", size=(100, 100)) self.field = wx.TextCtrl(self, -1, "Text", (30, 7)) def startLoop(self): co...
I need to work on a project that require NLTK so I started learning Python two weeks ago but struggling to understand Python and NLTK. From the NLTK documentation, I can understand the following codes and they work well if I manually add the word apple and pear into the codes below. from nltk.corpus import wordnet as w...
In my web app, the user can make blog posts. When I display the blog post, newlines aren't shown because I didn't replace the new lines with <br> tags. The problem is that I've turned autoescaping on in Jinja, so <br> tags are escaped. I don't want to temporarily disable autoescaping, I want to specifically allow <br> ...
nathéo Re : /* Topic des codeurs [8] */ Arf, j'ai oublié de traiter son cas je crois. C'est rarement par le sarcasme qu'on élève son âme.Le jus de la vigne clarifie l'esprit et l'entendement. De quoi souffres-tu ? De l'irréel intact dans le réel dévasté ? N'oubliez pas d'ajouter un [RESOLU] si votre problème est réglé....
The coloring is done by pygmentize, the command line interface to the Pygments library. The vim style as defined in Pygments is really suited for a dark background, so the 'easy' solution is to either specify a black background or to pick a pre-existing style that's suited for light backgrounds. If you'd like to specif...
I’ve had lots of requests for a Ruby version to follow up my Latent Semantic Analysis in Python article. So I’ve rewritten the code and article for Ruby. I wrote LSA from scratch this time and test driven so it has some subtle differences from the Python version. What is LSA? Latent Semantic Analysis (LSA) is a mathema...
When using Python strftime, is there a way to remove the first 0 of the date if it's before the 10th, ie. so 01 is 1? Can't find a %thingy for that? Thanks! You can use left strip to remove the leading zero's day = day.lstrip('0') >>> day = '01' >>> day.lstrip('0') '1' Actually I had the same problem and I realized th...
I am using itertools.groupby to parse a short tab-delimited textfile. the text file has several columns and all I want to do is group all the entries that have a particular value x in a particular column. The code below does this for a column called name2, looking for the value in variable x. I tried to do this using c...
Content of page not displayed after a form post, but displayed when directly viewing the page. I have a Python App Engine piece of code that is attempting to direct to a new page and display a programatically defined (i.e. in the code, not html) piece of text. However up pressing the submit button of the form I get a b...
Fairly new to python, forgive me if this is a basic question about learning how to use CSV files. import csv theReader = csv.reader(open('filename.csv'), delimiter=',') for line in theReader: print line So I've managed to open the file and can print it sprawling across my screen. But I'm trying to capture the data...
ADcomp Re : ADesk Bar : Barre de lancement rapide [python/gtk/cairo] Yep .. @ all : lien pour les sources rectifié ( ) @ frafa : -add n'importe quoi, puis fermer fenetre sans ajout, ajoute quand meme une entrée vide. tu devrait gerer ca... +1 -et si pas trop galere a coder avoir acces aux reglages d'un plug-in via clic...
There are some children sitting around a round table. Each child is given an even amount of $1$-cent coins ($0$ is even) by their teacher, all the children at once. A child will give half his money to the child by his right, then the receiving child gives half of his to the one by his right and it goes on like that. If...
I am new to python, and am making a sort-of game as one of my first projects that guesses a number between 1 and 10, then the user guesses it. They have three guesses, and the program tells the user if they need to go higher or lower on their next guess. The part of the code with the error in isn't crucial, as it only ...
When I use move(x, y) function in PyQt, to which exact coordinates does the widget move? I figured that x and y are relative to something, but to what? It depends on whether the widget has parent or not. If it does, the co-ordinates are relative to the parent widget; otherwise, they are relative to the desktop. Here is...
I want to find most optimal way to iterate values in key in python. I have file with that structure: 17 key1 18 key1 45 key2 78 key2 87 key2 900 key3 92 key4 so I need to set the second column as key(with no repetition) and link to this key all the values (first column) corresponding to it. 'key1':['17','18'] 'key2':['...
Trying to save output from this script to a file based on a cell within the csv. I am able to call the variable {file_root_name} to write into the xml file but not as a variable to write the file name. How can I use the variable file_root_name as a variable to generate a file name? import csv import sys from xml.etree ...
In this post, we are going to describe how we can use Fabric and the connector python to scale out read-only operations. We need to introduce some concepts first though. Fabric organizes the servers in high-availability groups, uses the standard MySQL Replication to synchronize the servers which can be classified accor...
I need to make an export like this in Python : # export MY_DATA="my_export" I've tried to do : # -*- python-mode -*- # -*- coding: utf-8 -*- import os os.system('export MY_DATA="my_export"') But when I list export, "MY_DATA" not appear : # export How I can do an export with Python without saving "my_export" into a fil...
I was wondering the same the other day, what I found on internet was that the best way to make a search with like and text is 'WORD%' with the % at the end (text that end with word will not be found) if you can't use that your query will go row by row and word by word, reading all the text of each result to find the ma...
This topic includes the following sections: The sample application in this topic contains a description of a one-client, one-server application using BEA Tuxedo /Q called qsample. An interactive form of this software is distributed with the BEA Tuxedo software. Before you can run the sample application, the BEA Tuxedo ...
I'm attempting to answer the primary question here with as thorough an explanation as I can. Developing and Testing Your Code Say you're writing a Python script designed to be used as a module: def do_important(): '''This function does something very important''' You could test the module by adding this call of th...
I was optimising some Python code, and tried the following experiment: import time start = time.clock() x = 0 for i in range(10000000): x += 1 end = time.clock() print '+=',end-start start = time.clock() x = 0 for i in range(10000000): x -= -1 end = time.clock() print '-=',end-start The second loop is reliably...
So far I have been able to work out a basic socket in python 3.2. The client sends some data, an X and a Y coordinate, to the server, and the server takes the data and sends back a confirmation message. But the trouble I'm having is getting it to listen between computers. My server and client work perfect when I run th...
James Edward Gray II’s Ruby Quiz #16 was to implement Rock, Paper, Scissors playing classes to compete on a playing field managed by a given Game class. Today we revisit this quiz for a bit of coding fun. We’ll implement some simple players and move on to some basic metaprogramming techniques and write players that man...
Defining: def switch1(value, options): if value in options: options[value]() allows you to use a fairly straightforward syntax, with the cases bundled into a map: def sample1(x): local = 'betty' switch1(x, { 'a': lambda: print("hello"), 'b': lambda: ( print("goodbye," + local), print("!")...
I am constantly frustrated by how complicated it is to write graphical programs that would have been only a few lines of code 20+ years ago. Since the invention of the mouse this has become even worse it seems. I was hoping someone could put me out of my misery and show the shortest code to do the following really basi...
Yes, using custom tags. Example in Python, making the !join tag join strings in an array: import yaml ## define custom tag handler def join(loader, node): seq = loader.construct_sequence(node) return ''.join([str(i) for i in seq]) ## register the tag handler yaml.add_constructor('!join', join) ## using your sam...
So I'm trying to make a class called Dean and this class has to be able to call upon the super class of say (just printing out a text). I was told to use Professor.say(self, stuff) to call upon the superclass of say but I don't really get that. My code is as follows: Class Dean(Professor): Professor.say(self, stuff...
I have a Tornado instance running behind a Nginx, and when a GET request hits Nginx first, it will direct the request to a handler in Tornado by using: proxy_pass http://127.0.0.1:8080; proxy_redirect off; then inside the corresponding handler in Tornado: class MyHandler(tornado.web.RequestHandle...
Hi guys, I've made a Python script which you can use to get notifications of the latest questions. It scrapes the unanswered-questions page and informs you via libnotify. Just click on the notification button to open a browser window on the question. Why not use an RSS reader?Well, this is more customized than an RSS r...
I recently spent some time restructuring the build environment for an OpenEmbedded-based linux project. I have no direct experience with Buildroot but I expect OpenEmbedded is similar enough to what you're using. I'll describe my setup and with any luck you'll find something here useful... The Problem There are three s...
I have two heapsort algorithms. The first one is written by me, while the 2nd one is taken from some website. According to me, both have the same logic, but the 2nd one is performing way better than the first. Any reason why is this happening? The only difference I can see is that mine uses a recursion, while the other...
EdLeH Re : pylote : un logiciel pour TBI Juste un petit message pour te signaler que la dernière archive que tu as uploadée est corrompue, je ne peux pas l'ouvrir. finalement ça tombe pas si mal ; j'en ai profité pour intégrer tes améliorations... Prends la version "sans demo" ; l'autre n'est pas encore uploadée. Le do...
Theres a couple of ways of doing this, each has their pros/cons, the following four where just from the top of my head ... pythons own random.sample, is simple and built in, though it may not be the fastest... numpy.random.permutation again simple but it creates a copy of which we have to slice, ouch! numpy.random.shuf...
I recently built a machine based on the ASUS M5A78L/USB3 motherboard and installed Ubuntu 12.04 LTS on it. Most of the system sensors were automatically detected and work correctly. However, when I run sensors, both the CHASSIS FAN and CPU FAN fields show the actual CPU fan speed. This happens regardless of whether a c...
It looks like you're new here. If you want to get involved, click one of these buttons! Dear all I have code as below. output window share output comig from serial port . read data should be written in to csv file output window>date is:7/12/16time is:24-0-0Zenith:104.85Azimuth:110.40Elevation:-14.85Converted Elevation:...
Email and SMS Setting up email Web2py provides the gluon.tools.Mail class to make it easy to send emails using web2py. One can define a mailer with from gluon.tools import Mail mail = Mail() mail.settings.server = 'smtp.example.com:25' mail.settings.sender = 'you@example.com' mail.settings.login = 'username:password' ...
Trying to insert data into my table on my database with Django. This is my model for the Table I'm trying to insert into: class RunableFilters(models.Model): equipment_id = models.BigIntegerField(null=True, blank=True) filter_file_name = models.CharField(max_length=255, blank=True) last_updated = models.Cha...
Hi I get a strange error message: Property user is corrupt in the datastoreCan you tell me what it means and what I should do? Here's the full trace 2011-05-04 01:35:15.144 Property user is corrupt in the datastore: Traceback (most recent call last): File "/base/python_runtime/python_lib/versions/1/google/appengine/a...
I'm trying to create an simple inbox-message app but I keep encountering this error. I know the error is pointing here if Message.objects.filter(in_response_to=messages.in_response_to): m = messages.in_response_to.id What I'm trying to convey is , If their is an object in messages.in_response_to . Do this . I don...
Sorry for a newbie question but I could not figure out how to print a text which a user enter in a GTKEntry field after he press a button. I design my app with glade, a simple TextEntry Field and a button. After I change the code of myappWindow.py: def on_button1_clicked(self, widget, data=None): print 'pressed' ...
Full text search with MongoDB Here I’ll present a simple full text search engine, that uses MongoDB as its backend. It’s implemented using MongoEngine, and is intended as more of a proof-of-concept than a viable alternative to “real” search engines such as Solr, Sphinx, etc. What will the search engine do? The search e...
I am running quickly 12.80.1-0ubuntu2 and for some reason the apps that I generate no longer recognise button clicks. A few weeks ago I created an application using the ubuntu-application template with multiple buttons which referred to the subprocess function. I tried to create an identical application today and it wi...
I want to use bottle.py over a wireless network. Unfortunately I do not know how to go about setting this up. The code I want to execute over a wireless network (Execute from another computer) is: import ctypes from bottle import get, post, request, run @get('/control') def message(): return '''<form method='POST' ...
I try to implement a code that read in a number n, creates a vector to store n double precision numbers, read this number, call a subroutine printminmax() to find min and max. My code work perfect for normal numbers (integer,real etc) but when i have scientific notation (0.3412E+01) stack.Why? I thought with * read all...
I'm trying to test some python code that uses urllib2 and lxml. I've seen several blog posts and stack overflow posts where people want to test exceptions being thrown, with urllib2. I haven't seen examples testing successful calls. Am I going down the correct path? Does anyone have a suggestion for getting this to wor...
Does anyone know of a example using Pyside with dynamic sizable table with a combobox delegate in a column? I tried modifying this example but I keep on getting the combo box that only displays when the cell is selected. Here is the is the example I started from: import sys from PySide import QtCore, QtGui class TableM...
wlourf Postez vos scripts Lua pour Conky ! Bonsoir à tous ceux pour qui chaque pixel du bureau compte, J'ouvre ce topic suite aux discussions sur le topic des conky pour discuter des scripts Lua dans conky. Lua est un langage de script léger et facile a utiliser qui permet d'ajouter de nouvelles fonctionnalités à nos c...
I would like to apply a function to a dataframe and receive a single dictionary as a result. pandas.apply gives me a Series of dicts, and so currently I have to combine keys from each. I'll use an example to illustrate. I have a pandas dataframe like so. In [20]: dfOut[20]: 0 10 2.025745 a1 -1.840914 b2 -0.428811 c3 0....
Is there a way to highlight built in Python functions in vim only when they are preceded by 1 more whitespaces? Furthermore, is there a modular way to do this? That is, I don't want to edit every single syn keyword pythonBuiltinFunc abs chr ... line, I just want to be able to say something like syn keyword pythonBuilti...
I need to get a count of records for a particular Model on app engine. How does one do it? I bulk uploaded more than 4000 records but modelname.count() only shows me 1000. As of release 1.3.6, there is no longer a cap of 1,000 on count queries. Thus you can do the following to get a count beyond 1,000: count = modelnam...
Published on O'Reilly Network (http://www.oreillynet.com/) See this if you're having trouble printing code examples by Cameron Laird and Boudewijn Rempt 07/07/2000 Editor's note -- Seldom do I run across an article on application development that is just plain fun. I have one here. There are four characters in this sto...
Here is a problem: we have a table with 8 trays. With probability $0.5$, there is a letter somewhere in the table. What is the probability that there is a letter in a last tray, given that there is no letter in first 7 trays? It looks trivial, but now I'm really confused. Here is how I solved it: let $A$ be the probabi...
I experienced a similar error today, concerning code that I know for a fact was working a week ago. I also have recently uninstalled/reinstalled both Matplotlib and Numpy, while checking something else (I'm using Python 2.5). The code went something like this: self.ax.cla() if self.logy: self.ax.set_yscale('log') self....
I have the following code inside a while True loop: if abs(playerx) < MAXSPEED: if moveLeft: playerx -= 1 if moveRight: playerx += 1 if abs(playery) < MAXSPEED: if moveDown: playery += 1 if moveUp: playery -= 1 if moveLeft == False and abs(playerx) > 0: playerx += 1 i...
Is there a method to build a balanced binary search tree? Example: 1 2 3 4 5 6 7 8 9 5 / \ 3 etc / \ 2 4 / 1 I'm thinking there is a method to do this, without using the more complex self-balancing trees. Otherwise I can do it on my own, but someone probably have done this already :) Thanks for the answers! This is the...
i am getting this error while uploading data to datastore using bulkuploader. Data used to be uploaded fine with the previous csv file. the new csv file has an extrafield that contains a list of strings. (ex. A,B,E,G,E,F). Following is the error that i get. Traceback (most recent call last): File "/opt/google_appengi...
As Ned pointed out, sys.excepthook is invoked every time an exception is raised and uncaught. The practical implication of this is that in your code you can override the default behavior of sys.excepthook to do whatever you want (including using logging.exception). As a straw man example: >>> import sys >>> def foo(exc...
Windows still got you trapped? Maybe SAMBA File System support is what you need. Michael Lucas explains how to use SMBFS. It is possible to access data on a Microsoft computer from your FreeBSD system if the two computers are networked together. In this article, we'll be using a utility called Sharity-Light to allow a ...
11 Sep 2014 I'm relatively new to the Rails community. I come from the Python/Django world, but I've been enjoying the transition, except for one minor part; Models. When I dig around looking for info on how to structure my code, I keep running into Best Practices that advocate for a skinny controller/fat model pattern...
(source: web2py and google appengine) It kicks ass. There's a video that demonstrates web2py and Google appengine that pretty much says it all. If you're like me, and you'd rather read a set of step-by-step instructions than watch a video, this is for you. (OK, this is actually for me when I start a new project 6 month...
I have a list of list that looks like this: ['000000000000012', 'AUD ', ' -1500000.0000', '29473550', 'TD CASH', 'Currencies', 'Unsettled Transactions', 'Unsettled']['000000000000012', 'BRL ', ' 6070.5400', ' ', 'TD CASH', 'Beginning Balance', 'Positions', 'Settled']['000000000000012', 'MXN ', ' 19524996.5400', ' ', 'T...
I wish to search a large text file with regex and have set-up the following code: import re regex = input("REGEX: ") SearchFunction = re.compile(regex) f = open('data','r', encoding='utf-8') result = re.search(SearchFunction, f) print(result.groups()) f.close() Of course, this doesn't work because the second argument ...
import os import sys import time import base64 import hmac import mimetypes import urllib2 from hashlib import sha1 from poster.streaminghttp import register_openers def read_data(file_object): while True: r = file_object.read(1 * 1024) print 'rrr',r if not r: print 'r' ...
As stated by ecline6, bird is the least of your worries at this point. Consider reading this book.. For now, First let's clean up your code... import pygame import os # let's address the class a little later.. pygame.init() screen = pygame.display.set_mode((640, 400)) # you only need to call the following once,so pull ...
pontiac76 [résolu]Google Ok mais pas internet avec Ubuntu 12.04 Bonjour, J'ai posté hier un message à propos de mon impossibilité d'aller sur internet sauf sur sur google avec mon installation toute neuve d'Ubuntu 12.04 LTS sur un second disque dur de mon pc fixe. Devant l'absence de réponse, j'ai relu les règles du fo...
I have 8823 data points with x,y coordinates. I'm trying to follow the answer on how to get a scatter dataset to be represented as a heatmap but when I go through the X, Y = np.meshgrid(x, y) instruction with my data arrays I get MemoryError. I am new to numpy and matplotlib and am essentially trying to run this by ada...
I have some code used to send emails. It works on windows but when I try run it on a mac (with the same user login as on the windows machine), it doesn't send an email or return any errors. Anyone have any experience with this kinda thing, or examples, tips, solutions pls? import smtplib import mimetypes from email imp...
I'm using the Python Imaging Library for some very simple image manipulation, however I'm having trouble converting a greyscale image to a monochrome (black and white) image. If I save after changing the image to greyscale (convert('L')) then the image renders as you would expect. However, if I convert the image to a m...
DJ Raging-Bull Carte PCMCIA WiFi non détecté sur ThinkPad 600X Bonjour, J'ai récuperé un IBM ThinkPad 600X équipé d'un Penium III @ 500 MHz et de 446 Mo de RAM, le disque dur fait environ 12 Go et il dispose d'un lecteur CD. J'aimerais le refiler à ma mère qui s'en servirait pour de la bureautique de base. Je lui ai do...
I'm trying to implement django-endless pagination on my project. Simple pagination works (with "show more" ) but twitter style (ajax based) is giving me troubles. This is my view: @page_template('userena/profil_page.html') # just add this decorator def public_details(request, username=None, template = 'userena/pro...