« first day (4 days earlier)      last day (30 days later) » 

12:15 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Error using redirect in pylons.

Joseph MisitiUsing Pylons verson 1.0: Working on the FormDemo example from the Pylons booK: pylonsbook.com/en/1.1/working-with-forms-and-validators.html My controller has the following fu...

python pylons
 
12:26 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
pygame vs. VPython for visualizing PyODE

NoneI made a program similar to the second PyODE tutorial but using VPython instead of pygame and I removed the coord function for changing coordinates. It works but the locating of the spheres and joints isn't correct. I am guessing that it is because I am using the PyODE world coordinates within...

python coordinates pygame vpython pyode
 
 
1 hour later…
1:30 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Idle Subprocess connection problem

IanI'm new to python programming, and want to try to edit scripts in IDLE instead of the OSX command line. However, when I try to start it, it gives me the error "Idle Subprocess didn't make a connection. Either Idle can't start a subprocess or personal firewall software is blocking the connectio...

python subprocess idle
 
1:41 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
run python file

user391179i dont have any experience in python programming but I get to run python file is there any one to help me pls here is the file content >>>>>>>>>>>>>> #!/usr/local/bin/python """ Based on: wxpsvg.googlecode.com/svn/trunk/svg...

python file run
 
2:14 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Difference between __getattr__ vs __getattribute__ in Python?

YarinTrying to understand when to use which. The documentation mentions __ getattribute__ applies to new-style classes- What are new-style classes?

python
 
2:41 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Using Lambdas to build executable functions from string expressions

phkahlerI'm using python, and I want a function that takes a string containing a mathematical expression of one variable (x) and returns a function that evaluates that expression using lambdas. Syntax should be such: f = f_of_x("sin(pi*x)/(1+x**2)") print f(0.5) 0.307692308 synta...

python math parsing lambda
 
3:08 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
[PyGTK] Move cursor upon right click in TextView?

SmartboyAt the moment, when one right clicks in a TextView, a popup menu is brought up, but the cursor doesn't actually change position to where one is right clicking, it just leaves the cursor alone. For me, whom is trying to implement a spell checking menu, this isn't good since I have to click THEN...

python pygtk
 
3:24 AM
newest questions tagged python - Stack Overflow
0
votes
1
answers
In Python - a way to choose which dictionary to iterate over (and manipulate values in)

user395463Here's my problem: Lets say I have two dictionaries, dict_a and dict_b. Each of them have similar keys and values that I can manipulate in the same way, and in fact that's what I'm doing in a large piece of code. Only I don't want to have to write it twice. However, I can't do...

python dictionary dictionaries
 
4:19 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
testing urllib2 application, http responses loaded from files

hal-robertsonMy python application makes many http requests to many urls using urllib2. I would like to build a unit test suite to test my data parsing and error handling code. I have a directory full of test data, with a number of files, each file containing a single http response, with headers a...

python urllib2
 
4:40 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Programming books in ePub format

NimbuzI purchased an iPad hoping to read books on it that've been aging on my desk for months, but it turned out that there're NO programming books available on iBookstore. Are there any (Python, PHP, jQuery) books available in ePub format? Conversion from pdf to epub is not an option becau...

jquery python pdf ebook epub
newest questions tagged python - Stack Overflow
0
votes
0
answers
list of all paths from source to sink in directed acyclic graph

TylerCan anyone point me to some resources on how to do this? I'm using networkx as my python library. Thanks!

python networkx dag directed-acyclic-graphs
 
5:08 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
interesting project that I can implement with fuse-python

Joseph ArdenHi, I was thinking of improving my python and just recently read an article about the python-fuse library. I'm always interested about filesystem stuff so I thought this would be a good library to hack on. What I can't come up with is an idea of what I should implement with th...

python learning project fuse
 
6:07 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
twitter request limit

gohhi guys , Regarding the twitter API request limit, how does one counts as a request? I'm using python-twitter, so if I have client = twitter.Api(username='acc',password='pw') self.client.GetFriends(result[0]) Does this count as 1 request? Or...

python twitter twitter-api
 
6:24 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
comparison between the elements of list with keys of dictionary

ShilpaI need to check if a particular key is present in some dictionary. I can use has_key ?? Is there any other method to compare the items of the list to the key of dictionary. I have a list like...[(3,4),(4,5)..] I need to check if the (3,4) is there in the dictionary.

python dictionary
newest questions tagged python - Stack Overflow
0
votes
0
answers
Doc,rtf and txt reader in python

RajeevLike csv.reader() are there any other functions which can read .rtf,.txt,.doc files in Python?

python pythonic python3
 
6:35 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Stand-alone fabfile for fabric?

Tal WeissIs it possible to make the fabfile stand-alone? I'm not very fond of running the external tool 'fab'. If I manage to get the fabfile standalone I can run the file from within the (Eclipse / Pydev) IDE, easily debug it, use project configurations and paths etc. Why doesn't this work:

python fabric
 
7:02 AM
newest questions tagged python - Stack Overflow
0
votes
1
answers
Comparing dates in Python

Mridang AgarwallaHere's a little snippet that I'm trying execute: >>> from datetime import * >>> item_date = datetime.strptime('7/16/10', "%m/%d/%y") >>> from_date = date.today()-timedelta(days=3) >>> print type(item_date) <type 'datetime.datetime'> >...

python
newest questions tagged python - Stack Overflow
0
votes
0
answers
python dictionary key Vs object attribute

nazmul hasansuppose i have object has key 'dlist0' with attribute 'row_id' the i can access as getattr(dlist0,'row_id') then it return value but if i have a dictionary ddict0 = {'row_id':4, 'name':'account_balance'} getattr(ddict0,'row_id') ...

python dictionary object
 
7:19 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Python Chain getattr as a string

Hellnarimport amara def chain_attribute_call(obj, attlist): """ Allows to execute chain attribute calls """ splitted_attrs = attlist.split(".") current_dom = obj for attr in splitted_attrs: current_dom = getattr(current_dom, attr) return current_dom doc = ...

python getattr amara
newest questions tagged python - Stack Overflow
0
votes
0
answers
Importing csv file into postgres

joreezyUsing Mysql Administrator GUI tool - I have exported some data tables retrieved from an sql dumpfile into csv files. I then tried to import these csv files into a postgres database using the postgres COPY command. I've tried entering "COPY articles FROM '[insert .csv dir here]' DELIMIT...

python database postgresql csv import
 
7:30 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Why is this code not accepting this png images transparency?

anteater7171I've isolated the cause of the problem to be the image, since the code seems to work with other png images with transparency. However, it doesn't seem to work with the one image I need it to. This would be of great help seeing as I'm trying to make a nice shaped window. The image:...

python wxpython png transparency shaped-window
 
8:24 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Negative coordinates in pygame

feelieWhat would be the best way to use negative coordinates in pygame? At the moment I have a surface that is 1.5 times the original surface then everything that needs to be drawn is shifted up by a certain amount (to ensure the negative coordinates become positive) and drawn. Is th...

python coordinates pygame surface negative
newest questions tagged python - Stack Overflow
1
votes
1
answers
Python pack arguments??

user395589Hi, is to possible to "pack" arguments in python? I have the following functions in the library, that I can't change (simplified): def g(a,b=2): print a,b def f(arg): g(arg) I can do o={'a':10,'b':20} g(**o) 10 20 but...

python arguments unpacking
 
8:46 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Invert colormap in matplotlib

MermozI would like to know how to simply reverse the color order of a given colormap in order to use it with plot_surface.

python matplotlib
 
8:57 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Python implementation of Jenkins Hash?

DavidRDoes there exist a native Python implementation of the Jenkins hash algorithm(s)? I need a hash algorithm that takes an arbitrary string and turns it into an 32-bit integer. For a given string, it must guarantee t...

python hash
 
9:13 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Python: How do i manipulate the list to get the string starting with '+' ?

kimberlyHi, I am comparing 2 txt files that are ls -R of the etc directory in a linux system. I compared the 2 files using difflib.differ and got this list as my result (i put the dots to keep the list short in here): result = [' etc:\n', ' ArchiveSEL\n', ' HOSTNAME\n', ' RMCPUser\n', . . . ' ...

python
 
9:30 AM
newest questions tagged python - Stack Overflow
2
votes
0
answers
Method for dry runs?

Marten BauerHello, at the moment my python code often looks like this: ... if not dry_run: result = shutil.copyfile(...) else: print " DRY-RUN: shutil.copyfile(...) " ... I now think about writting something like a dry runner method: def ...

python
newest questions tagged python - Stack Overflow
0
votes
0
answers
How do I convert a python string to ucs2 hex?

apple_pieHi Guys, I've been searching for this one and couldn't find it, although it seems simple. I need to send in a ucs2 hex string in the url, and I don't know how to convert a python string to be ucs2 hex. Any thoughts?

python encoding
newest questions tagged python - Stack Overflow
1
votes
0
answers
How to use a custom __init__ of an app engine Python model class properly?

thorwilI'm trying to implement a delayed blog post deletion scheme. So instead of an annoying Are you sure?, you get a 2 minute time frame to cancel deletion. I want to track What will be deleted When with a db.Model class (DeleteQueueItem), as I found no way to delete a tas...

python google-app-engine
newest questions tagged python - Stack Overflow
0
votes
0
answers
Python: How do i split the file?

kimberlyI have this txt file which is ls -R of etc directory in a linux system. Example file: etc: ArchiveSEL xinetd.d etc/cmm: CMM_5085.bin cmm_sel storage.cfg etc/crontabs: root etc/pam.d: ftp rsh etc/rc.d: eth.set.sh rc...

python
 
10:08 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Sorting a list pairs by frequency of the pair elements

DMA57361I'm completely new to Python and while trying various random bits and pieces I've struck upon a problem that I believe I've "solved", but the code doesn't feel right - I strongly suspect there is going to be a better way to get the desired result. FYI - I'm using whatever the ...

python beginner sorting
 
10:19 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Using select_related and extra clause

Ghislain LevequeI'm trying to achieve some extra select on a queryset and wants to add the needed table to the pool of tables in the query using the select_related method in order to benefit for the '__' syntax. Here is an example with simple models : from django.db import models # Cr...

python django query
 
10:41 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
httplib2 and socks server

sultanIs there any way to use httplib2 via protected socks server using some password and username, does add_credentials method work well in this case? For now I have a code show below proxy.add_credentials(account.get('USER'), account.get('PASS'))

python httplib2
newest questions tagged python - Stack Overflow
0
votes
0
answers
Best way to check new-line-independent-identity of 2 files with python

kai1968I tried filecmp.cmp(file1,file2) but it doesn't work since files are identically except for new line characters. Is there an option for that in filecmp or some other convenience function/library or do I have to read both files line by line and compare those? ...

python file compare
 
10:57 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Bandwidth test, delay test using urllib2

LarsI want to make a python script that tests the bandwidth of a connection. I am thinking of downloading/uploading a file of a known size using urllib2, and measuring the time it takes to perform this task. I would also like to measure the delay to a given IP address, such as is given by pinging ...

python urllib2 bandwidth
 
11:30 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Adding server certificate validation to httplib.HTTPSConnection

jellybeanI've found that httplib.HTTPSConnection doesn't perform an automatic server certificate check. As far as I've understood the problem, I need to add that functionality manually, e.g. by subclassing this class as described

python validation certificate m2crypto httplib
 
11:41 AM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Content-based routing with RabbitMQ and Python

saflIs it possible with RabbitMQ and Python to do content-based routing? The AMQP standard and RabbitMQ claims to support content-based routing, but are there any libraries for Python which support specifying content-based bindings etc.? The library I am currently using (py-amqplib...

python routing rabbitmq amqp
 
12:02 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Format date based on locale in python

Nicolae SurduI have a date output like >>> import time >>> print time.strftime("%d %B") 19 July Is there a way to format the date based on the locale, but still have control of what is shown (in some cases I don't want the year). For example, on a...

python time formatting locale
 
12:46 PM
newest questions tagged python - Stack Overflow
0
votes
1
answers
Equivalent of __DATE__ and __TIME__ in Python?

compieIs there an equivalent of __DATE__ and __TIME__ in Python?

python datetime
newest questions tagged python - Stack Overflow
0
votes
0
answers
terminate script of another user

clorzOn a linux box I've got a python script that's always started from predefined user. It may take a while for it to finish so I want to allow other users to stop it from the web. Using kill fails with Operation not permitted. Can I somehow modify my long running python script so...

python linux signals kill
 
1:08 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Setting the system date in Python (on Windows)

Gary OldfaberThere appears to be many packages for getting/formatting the current date, or finding out the date n time intervals from now. But I must be overlooking the existence of a simple method to set the date (like Windows' date.exe) in Python. Surely such a function exists? I've been unable t...

python datetime date
newest questions tagged python - Stack Overflow
0
votes
0
answers
Automatically all all functions matching a certain pattern in python

celilIn python I have many functions likes the ones below. I would like to run all the functions whose name matches setup_* without having to explicitly call them from main. The order in which the functions are run is not important. How can I do this in python? def setu...

python automation
 
1:35 PM
newest questions tagged python - Stack Overflow
2
votes
0
answers
Best way to install python packages locally for development

stsquadBeing new to the python games I seem to have missed out on some knowledge on how you can develop on a program but also keep it in your live environment. Programs like gpodder can be run directly from the source checkout which is really handy however others want to be "installed" to ru...

python installation
newest questions tagged python - Stack Overflow
0
votes
0
answers
Really awkward (seemingly simple) bug with python integer comparisons.

ahhtwerI have the following piece of code which is not working the way I expect it to at all... current_frame = 15 # just for showcasing purposes g_ch = 7 if (current_frame is not int(row[0])) and (int(row[1]) is not g_ch): current_frame = int(row[0]) ...

python troubleshooting
 
2:14 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Checking duplicate while inserting in SQLite

TiNSHello All, I am trying to insert a data into SQLite database using Python. INSERT INTO DATA_TABLE(UID,LABEL) VALUES (NULL, "UK") WHERE "UK" NOT EXISTS IN (SELECT LABEL FROM DATA_TABLE); This query is dynamically generated from Python and I am che...

python windows sqlite pysqlite
 
2:25 PM
newest questions tagged python - Stack Overflow
1
votes
3
answers
python - list operations

Cristi DiaconescuGiven a list of unsorted numbers, I want to find the smallest number larger than N (if any). In C#, I'd do something like this (checks omitted) : var x = list.Where(i => i > N).Min(); What's a short, READABLE way to do this in Python?

python list kiss
 
2:41 PM
newest questions tagged python - Stack Overflow
1
votes
0
answers
Compiling a PyObjC application for 10.5 (leopard) into xcode 10.6 (snow)

fabio.cioniniHello, I'm trying to deploy on 10.5 a PyObjC (or Cocoa-Python) application developed on Xcode 3.2.X (Snow Leopard) which runs perfectly fine on 10.6 systems. Running it in 10.5 though seems not possible. The application crashes at launch giving this error message (found on Crash Report): ...

python cocoa pyobjc
 
2:52 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Python, suds, Error.

PolWhen I'm trying get method from remote webservice it gives me error. My code is: portion=10 start=0 print self.stamp.datetime client=self.client while 1: print 'getting ids...........' fresh_ids=client.service.Ge...

python suds
 
3:25 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Evince Windows Python Bindings

cferbsHi i am trying to make a gtk python application and i want to incorperate evince bindings so i can display a pdf in my applicaiton. I know in linux you can just install the bindings and use import evince. but i don't know where i can get them for windwos. i downloaded the ubuntu python-evince....

python windows pdf module gtk
newest questions tagged python - Stack Overflow
0
votes
0
answers
What python virtual environment and deployment solution should I use?

Sorin SbarneaI'm looking for a virtual environment solution for Python applications and I would like something that respects these requirements: Windows and Linux works with x86/x64 Python versions easy to use/maintain Python 2.6-2.7 compatible and preferably even 3...

python virtualenv buildout
newest questions tagged python - Stack Overflow
1
votes
0
answers
Python Threading with Timer

collinsI would like 3 Threads in Python to run for n seconds. I want to start them all at the same time and have them finish at the same time (within milliseconds). How do I do this? threading.Timer only starts after the previous one has been completed.

python thread timer
 
3:47 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Critique my prime_factors() function

DaenythI just wrote this function to break a number into its prime factors. Is the algorithm I'm using a good one? How might I improve this function? So far it seems to be working quite well. from copy import copy # Decorator to memoize using the first argument only @memoize_first de...

python math recursion critique
newest questions tagged python - Stack Overflow
1
votes
1
answers
How to convert a Python string representing bytes into actual bytes?

Juanjo ContiI have a string like: "01030009" and I want to get another string (because in Python 2.x we use strings for bytes) newString which will produce this result: for a in newString: print ord(a) 0 1 0 3 0 0 0 9 Thanks

python
 
4:09 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Getting parameters from a file via shell script into python script in the right format

nieldwI have the following shell script: #! /bin/sh while read page_section page=${page_section%%\ *} section=${page_section#* } #NOTE: `%* }` is NOT a comment wget --quiet --no-proxy www.cs.sun.ac.za/hons/$page -O html.tmp & wait # echo ${page_section%%\ *} # verif...

python bash argument-passing
newest questions tagged python - Stack Overflow
0
votes
0
answers
Question about nested loops

user395985Hello. I am new to programming and having some problem figuring out nested loops. I have a list of data that I want to extract from a larger file. I am able to extract one item of data from the larger file successfully but I need to extract 100 different trials from this larger file of thousan...

python loops nested in
newest questions tagged python - Stack Overflow
1
votes
3
answers
Python: get key with the least value from a dictionary

blob8108If I have a Python dictionary, how do I get the key with the minimum value? I was thinking about something to do with the min() function... Given the input: {320:1, 321:0, 322:3} It would return 321. Any ideas?...

python minimum dictionaries
 
4:25 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
[python] Looking for a PHP's str_split() replacement

unreal4uLet's say I have this little piece of code: <?php $tmp = str_split('hello world!',2); // $tmp will now be: array('he','ll','o ','wo','rl','d!'); foreach($tmp AS &$a) { // some processing } unset($tmp); ?> How can I do this in Python v2.7?

python
newest questions tagged python - Stack Overflow
0
votes
0
answers
Python treemap infograph

PrimozWhat is the easiest way to draw such graph in python ? Is there any library that suports it and I need only to provide data ? link: upload.wikimedia.org/wikipedia/commons/9/95/Heatmap...

python library treemap
 
4:53 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
How can you make Pylons email you the full post parameters with an error report?

Alexander SpicerPylons can email you errors when something goes wrong in production mode, but it truncates the post parameters so it's hard to see what the error is. Is there a way to make it email you the whole thing?

python django post error-message pylons
newest questions tagged python - Stack Overflow
0
votes
0
answers
reddit get_comments action, can someone clarify what is going on here?

BlankmanI'm trying to understand reddit's source, and I am looking at the get_comments action method of front.py This is the action that displays a story: code.reddit.com/browser/r2/r2/contro...

python pylons reddit
newest questions tagged python - Stack Overflow
0
votes
0
answers
Understanding Python scope distinctions

YarinCan you help me critique/complete the following statements? A variable is either local or global. A variable is scoped to its enclosing function, class, or file. If a variable is bound anywhere within a function, including nested functions and sub-statements, i...

python homework variable-scope
newest questions tagged python - Stack Overflow
2
votes
5
answers
python and using 'self' in methods

BlankmanFrom what I read/understand, the 'self' parameter is similiar to 'this'. Is that true? If its optional, what would you do if self wasnt' passed into the method?

python self
newest questions tagged python - Stack Overflow
1
votes
3
answers
2 digit years using strptime() is not able to parse birthdays very well.

casrConsider the following birthdays (as dob): 1-Jun-68 1-Jun-69 When parsed with Python’s datetime.strptime(dob, '%d-%b-%y') will yield: datetime.datetime(2068, 6, 1, 0, 0) datetime.datetime(...

python strptime 2-digit-year
 
5:20 PM
newest questions tagged python - Stack Overflow
0
votes
4
answers
finding out absolute path to a file from python

user248237if I have a file test.py that resides in some directory, how can I find out from test.py what directory it is in? os.path.curdir will give the current directory but not the directory where the file lives. If I invoke test.py from some directory "foo", os.curdir will return foo but not the pa...

python filesystem input-output
 
5:36 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Python "NoneType is not callable" error

tyI have a function that looks like the following, with a whole lot of optional parameters. One of these parameters, somewhere amidst all the others, is text. I handle text specially because if it is a boolean, then I want to run to do something based on that. ...

python types
newest questions tagged python - Stack Overflow
0
votes
0
answers
Fetch an email with imaplib but do not mark it as SEEN

PanosJeeHello everyone, I want to parse some emails from a user 's inbox but when I do: typ, msg_data = imap_conn.fetch(uid, '(RFC822)') It marks the email as SEEN or read. This is not the desired functionality. Do you know how can I keep the email at its previous sta...

python gmail imaplib
newest questions tagged python - Stack Overflow
0
votes
2
answers
Is this an acceptable pythonic idiom?

threecheeseoperaI have a class that assists in importing a special type of file, and a 'factory' class that allows me to do these in batch. The factory class uses a generator so the client can iterate through the importers. My question is, did I use the iterator correctly? Is this an acceptable idiom? I've...

python
 
5:58 PM
newest questions tagged python - Stack Overflow
1
votes
1
answers
Can I format a variable in python?

FelipeIs there a way of formating a variable? For example, I'd like to automate the creation of a variable named M_color, where M is a string of value "bingo". The final result would be bingo_color. What should I do if the value of M changes during the execution?

python
newest questions tagged python - Stack Overflow
0
votes
0
answers
Mod_python and unit testing

markwatsonIt there an easy way to do unit testing on an application written with mod_python? Something where I can generate dummy request objects easily. Thanks!

python unit-testing mod-python
 
6:15 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Running subprocess.call to run a Cocoa command-line application

Abe SchneiderI have one piece of Cocoa code I wrote that takes in an XML file containing bounding boxes that are then drawn on top of a video (each box has an associated frame). The Cocoa program is meant to be run from the command line (and takes in all its parameters as command line arguments) I ...

python cocoa subprocess
 
6:42 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Phyton in Windows

user396123hi , I am new to phyton and need some help. i need to write a script that will look for file in c:/script/test/ directory with ext ".dat" and find "^" in there and replace with "|" i am not sure how to write this. There will only be one file for a day in the directory w...

python
newest questions tagged python - Stack Overflow
0
votes
0
answers
Decode Hex String in Python 3

thebackhandIn Python 2, converting the hexadecimal form of a string into the corresponding unicode was straightforward: comments.decode("hex") where the variable 'comments' is a part of a line in a file (the rest of the line does not need to be converted, as it ...

python python-3
newest questions tagged python - Stack Overflow
0
votes
0
answers
python dictionary, keeping a count of integers

studentI am trying to count a list of say, integers. I have a list of numbers in a csv file I am able to read in, that looks something like 4,245,34,99,340,... What I am doing is trying to return is a dictionary with key:value pairs where the key is an integer value from the csv file, and the value ...

python dictionary
 
6:58 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
How do I get the concrete name of a class reference in Python?

sdolanThis is what I have so far: def get_concrete_name_of_class(klass): """Given a class return the concrete name of the class. klass - The reference to the class we're interested in. """ # TODO: How do I check that klass is actually a class? # even better would be determine if it...

python classes
 
7:15 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
GAE WSGIApplication and multiple request

B11002In dev_appserver class MainPage(webapp.RequestHandler): def get(self): self.response.out.write("Hello MainPage") class TestPage(webapp.RequestHandler): def get(self): # 10 seconds i = 1 while True: if i == 10: break time.sleep(1) ...

python google-app-engine request
 
7:26 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
python handle endless XML

ChrisI am working on a application, and my job just is to develop a sample Python interface for the application. The application can provide XML-based document, I can get the document via HTTP Get method, but the problem is the XML-based document is endless which means there will be no end element...

python xml
newest questions tagged python - Stack Overflow
0
votes
0
answers
Command Line in R code

Btibert3Hi all, Let me start by saying I am new to programming. I am hoping to run a python script from the command line within an R script. I am running windows xp but also have a machine that runs Windows 7. I can run the following code without error for the dos-prompt.

python command-line r
 
7:37 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
How do I set a world background texture in Blender 2.49 using Python ?

George ProfenzaHello, I'm trying to set a background World Texture in Blender 2.49. I've made a texture: import Blender from Blender import * import bpy world = World.GetCurrent() worldTex = Texture.New('worldTex') worldTex.setType('Image') worldIm = Image.Load('//blend...

python 3d textures blender bpython
 
8:10 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Regex match words and end of string

ultimatebuster2 Regex question How can I match a word or 2 words in a subpattern ()? How can i match a word or 2 words that's either followed by a specific word like "with" OR the end of the string $ I tried (\w+\W*\w*\b)(\W*\bwith\b|$) but it's def...

python regex
 
8:32 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Any way to run python TK scripts on web page?

RamsayIs there any way to run a python script that utilizes TKinter on a web page such that a user could run the script and interact with the TK windows without having to download the script or have the appropriate python interpreter?

python web tkinter 2.0
newest questions tagged python - Stack Overflow
0
votes
1
answers
Python 3 chokes on CP-1252/ANSI reading

altieI'm working on a series of parsers where I get a bunch of tracebacks from my unit tests like: File "c:\Python31\lib\encodings\cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode ...

python unicode latin1 cp1252 python-3
 
9:21 PM
newest questions tagged python - Stack Overflow
0
votes
1
answers
Python IDEA that you can highlight a method/class and jump to its definition

BlankmanI'm trying to use textmate, but I find it hard to navigate a project with it. I admit I probably just don't know the the IDEA well enough. Is it possible to highlight a class or method and jump to its definition?

python ide
newest questions tagged python - Stack Overflow
0
votes
0
answers
How to switch backend in matplotlib / Python

DrDeeHi, I am struggling with the following issue. I need to generate reports that consists of a collection of charts. All these charts, except one, are made using Matplotlib default backend (TkAgg). One chart needs to be made using the Cairo backend, the reason is that I am plotting an igr...

python matplotlib
 
9:32 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
How to get an attribute just from the current class and not from possible parent classes?

MitarHow to get an attribute just from the current class and not from possible parent classes? If I use getattr it traverses class hierarchy but I would like to get None if attribute is not defined in the current class (even if it is defined in some parent class).

python objects
newest questions tagged python - Stack Overflow
0
votes
0
answers
Fuzzy URL compare in Python?

Colin DavisAre there any tools to do a fuzzy URL compare in Python? For example, if I have google.com another string with google.com [0] and a trailing slash I'd like to know that they are likely to be the same site. If I were to construct a...

python fuzzy-comparison
newest questions tagged python - Stack Overflow
0
votes
0
answers
Help with a custom GUI in wxpython

anteater7171I'm new to wxpython, so bare with me. I'm creating a custom GUI set up and need to get two attributes. Firstly I want to create an inner boarder of a different color (The single dark boarder looks too plane). Secondly, I need to bind the dragging attribute so that only the label will allow dra...

python gui wxpython
newest questions tagged python - Stack Overflow
0
votes
0
answers
Ruby equivalent to python __main__

RodrigueIf in a ruby file I define a function like so: def tell_the_truth() puts "truth" end is there an equivalent to python's if __name__ == "__main__": tell_the_truth() ? Is it to simply call tell_th...

python ruby main-
 
9:54 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Remove items with checkboxes in Django forms

TeegijeeI'm writing a form with Django. The form is a model form for a certain model, Experiment. Each Experiment has several TimeSlot models associated with it, defined with a ForeignKey('Experiment'). I'd like to have a form with the option to remo...

python django django-forms
 
10:05 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Prime number function recurrence formula

Tony VeijalainenI am trying to optimize further the champion solution in prime number thread by taking out the complex formula for sublist length. len() of the same subsequence is too slow as len is expencive and generating the subsequence is expensive. This looks to slightly speed up the function but I could...

python list length primes slicing
 
10:16 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
wxPython Geometry problem

anteater7171I'm trying to get the button to be right of the label. I set the tuple and am still not sure why it covers the label. Also is there a good tutorial available on wxpython geometry? import wx import wx.lib.agw.gradientbutton as GB def GetRoundBitmap( w, h, r ): mas...

python geometry wxpython
 
10:27 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Numpy records in the c api

caiushI'm playing with writing some C code to speed up an inner loop in my python code. This loop operates on a numpy record, e.g. soemthing like this: a = numpy.zeros((10,), dtype=[("myfvalue" ,"float"), ("myc", "int8"), ("anotheri", "uint64")]) which is then passed into c code like...

python numpy
newest questions tagged python - Stack Overflow
0
votes
0
answers
CSV, DictWriter, unicode and utf-8

JoelHi, I am having problems with the DictWriter and non-ascii characters. A short version of my problem: #!/usr/bin/env python # -*- coding: utf-8 -*- import codecs import csv f = codecs.open("test.csv", 'w', 'utf-8') writer = csv.DictWriter(f, ['field1'], delimiter='\t...

python unicode csv utf-8
 
10:38 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Installing MySQLdb on Snow Leopard

StuPlumI'm having all sorts of trouble trying to instal MySQLdb (1.2.2) on snow leopard. I am running python 2.5.1 and MySQL 5.1 32bit. Python and MySQL are running just fine. I've also installed django 1.2.1, although I don't think thats all that important, but wanted to give an idea...

python mysql django mysqldb
 
10:49 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Customize Python unittest report with HTML or Textile

khelllHey, I'm using unittest for testing my python code. I'm seeking a way that I can do the following: Customize the report of test run. Export it as HTML or Textile document. Any ideas?

python html customization unittest textile
newest questions tagged python - Stack Overflow
1
votes
1
answers
Python: How to Capture WebPage as Image File?

tlowI want to cache a webpage as an image upon a user request, but I don't know where to start with this. I'm developing on App Engine with python.

python google-app-engine image-processing app engine
newest questions tagged python - Stack Overflow
0
votes
0
answers
QWebView - dealing with javascript infinite loop

Jesse Aldridgeweb_view_crash.py import sys from PyQt4.QtGui import * from PyQt4.QtCore import * from PyQt4.QtWebKit import * app = QApplication(sys.argv) view = QWebView() view.settings().setAttribute(QWebSettings.JavascriptEnabled, True) view.load(QUrl('infinite_loop.html')) view.show() a...

javascript python pyqt pyqt4 qwebview
newest questions tagged python - Stack Overflow
0
votes
0
answers
Tornado Session Management

PlaidFanWe are trying to integrate beaker into our Tornado web server environment. We attempted to use the forked version of Tornado (github.com/milancermak/tornado/tarball/master) which includes some session management but found that session cookies are failing in certain browsers. Therefore...

python tornado beaker
 
11:32 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
wxPython threaded UDP server

EefHi, I am trying to put together a UDP server with a wxPython GUI. Here is a link to the code: UDP Server pastie.org I have linked it as its pretty lengthy. I have successfully got...

python threads socket wxpython udp
 
11:54 PM
newest questions tagged python - Stack Overflow
0
votes
0
answers
Google App Engine Python ImportError Module Not Found

tlowI'm using Pydev 1.5.9 and the latest version of google app engine, developing in eclipse 3.6 I've set up my environment, and I have my base code executing fine. Now I'm trying to import the simplejson library using import simplejson I've tried 1) adding the simplejson ...

python eclipse pydev
 

« first day (4 days earlier)      last day (30 days later) »