if I run this...
import ipdb
print 'a'
ipdb.set_trace()
print 'b'
and then type 'q' to quit I get a 300 line error message.
python 2.5.4 on windows.
> d:\python25\scripts\a.py(4)<module>()
2 print 'a'
3 ipdb.set_trace()
----> 4 print 'b'
ipdb> q
ERROR: An unexpected error occurred while tokenizing input
The following tracebac...
I made a Python program that switches the entire monitor back and forth between random colours very quickly. I'm wondering if it can harm my monitor somehow.
Also on an unrelated note, it's tripy to stair at the program for extended periods of time.
The program
import Tkinter
import random
class AppTk(Tkinter.Tk):
def __init__...
I have a WxPython app that, among other things, has a integrated file-browser.
I want to be able to create a system-default file context menu (e.g. what you get if you right-click on a file in windows explorer) when a user right clicks on one of the items within my application.
Note: I already know how to create my own context menu (e....
I'm using Apache, Python (fastcgi), mod_rewrite.
I want
http://foo/bar
to redirect internally to
http://main.py?q=foo/bar
Now my .htacess file contains
Options +ExecCGI
AddHandler cgi-script .py
DirectoryIndex main.py
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) mai...
I'm using python's lxml to validate xmls against a schema. I have a schema with an element:
<xs:element name="link-url" type="xs:anyURL"/>
and I test, for example, this (part of an) xml:
<a link-url="server/path"/>
I would like this test to FAIL because the link-url doesn't start with http://. I tried switching anyURI to anyURL but...
I'm trying to think of a way to place Flash content into a blog post so that it appears inline between paragraphs. I'm writing a custom weblog application in Django (still learning) and I'll be using SWFObject for the embedding.
The blog is for me only so the back-end isn't too fancy. I'm simply using Django's built in admin interface....
This string:
"CREATE USER %s PASSWORD %s", (user, pw)
always gets expanded to:
CREATE USER E'someuser' PASSWORD E'somepassword'
Can anyone tell me why?
Edit:
The expanded string above is the string my database gives me back in the error message. I'm using psycopg2 to access my postgres database. The real code looks like this:
con...
I'm developing under Pylons using Mako templates. The problem is that I need to assign a string from some attribute of tmpl_context to a JavaScript variable in a page body. The additional problem is that this string can be quite arbitrary, ie can contain such characters like ", ', <, >, etc... Is there a common way to do such assignment?...
hi is there a build'in function of python that does on python.array what argsort() does on a numpy.array?
...
I have a project coming up for client who is basically happy with how he manages his website. It's lots of HTML files (around 300 of them) that he insists on keeping flat HTML files so can easily edit and manage them using Dreamweaver. His site has a lot of traffic and so I'm looking into options of keeping things simple for him. He does...
I want to selectively hide some resources based on some form of authentication in web.py, but their existence is revealed by 405 responses to any HTTP method that I haven't implemented.
Here's an example:
import web
urls = (
'/secret', 'secret',
)
app = web.application(urls, globals())
class secret():
def GET(self):
...
Hello Experts. I have a prob. I'm trying to create a custom slugify functiom. I use django.autoslug. Due to autoslug documentation I was able to create a custom slugifier, but it needs to be improved and I do not know how do I realize that.
So I have a string (book title) i.e. .NET Framework 4.0 with C# & VB in VisualStudio 2010. I want...
I need to get info from a website that outputs it between <font color="red">needed-info-here</font> OR <span style="font-weight:bold;">needed-info-here</span>, randomly.
I can get it when I use
start = '<font color="red">'
end = '</font>'
expression = start + '(.*?)' + end
match = re.compile(expression).search(web_source_code)
needed_i...
How do you zip two sequences in Clojure? IOW, What is the Clojure equivalent of Python zip(a, b)?
EDIT:
I know how to define such a function. I was just wondering whether standard library provides such a function already. (I would be *very* surprised if it doesn't.)
...
Please help me to discover whether this is a bug in Python (2.6.5), in my competence at writing regexes, or in my understanding of pattern matching.
(I accept that a possible answer is "Upgrade your Python".)
I'm trying to parse a Yubikey token, allowing for the optional extras.
When I use this regex to match a token without any opti...
I had my sqlalchemy related code in my main() method in my script.
But then when I created a function, I wasn't able to reference my 'products' mapper because it was in the main() method.
Should I be putting the sqlalchemy related code (session, mapper, and classes) in global scope so all functions in my single file script can refer to...
In this tutorial it says (http://www.rmunn.com/sqlalchemy-tutorial/tutorial.html) to select all rows of an entity like:
s = products.select()
rs = s.execute()
I get an error saying:
This select object is not bound and does not support direct execution ...
Do I need to reference the session object?
I just want to get all rows in my ...
So I have a recordset (sqlalchemy) of products that I am looping, and I want to download an image and save it to a folder.
If the folder doesn't exist, I want to create it.
Also, I want to first check if the image file exists in the folder. If it does, don't download just skip that row.
/myscript.py
/images/
I want the images folde...
Hi.
I have multiple templates that include each other, such as :
t1.html :
...
<%include file="t2.html" args="docTitle='blablabla'" />
...
t2.html:
<%page args="docTitle='Undefined'"/>
<title>${docTitle}</title>
...
And what I want to do is to determine that t2 is included by t1 (or another one, so I can use its name). No specifi...
I drop the following feed into Google Reader, and it update normally.
http://www.indeed.ca/rss?q=&l=Hamilton%2C+ON
However, when I use any of a number of approaches suggested thither and yon on the 'net that simply involve reading from this source and parsing the XML I receive the same 20 items.
What is Google Reader doing that I...