I am currently evaluating using PyQt in a commercial application, and I was surprised to learn that the PyQt Commercial License does not permit you to expose any of the PyQt library in the application's script API. From the PyQt site:
The right to distribute the required PyQt modules and QScintilla library with your applications so l...
I'm trying to add authenticating proxy support to an existing script, as it is the script connects to a https url (with urllib2.Request and urllib2.urlopen), scrapes the page and performs some actions based on what it has found. Initially I had hoped this would be as easy as simply adding a urllib2.ProxyHandler({"http": MY_PROXY}) as an ...
(Disclaimer: I asked this question yesterday on HN http://bit.ly/m6onk. While responses were good, there was a notable lack of technical discussion and more of a "you should use rails because that's what you know". Since Joel and Jeff state clearly they don't mind reposts of questions from other sites...and since I really enjoy the answe...
I'm trying to do some simple string manipulation with the href attribute of a hyperlink extracted using Beautiful Soup:
from BeautifulSoup import BeautifulSoup
soup = BeautifulSoup('<a href="http://www.some-site.com/">Some Hyperlink</a>')
href = soup.find("a")["href"]
print href
print href[href.indexOf('/'):]
All I get is:
Traceba...
Hi all,
I'm parsing human-readable scientific text that is mostly in the field of chemistry. What I'm interested in is breaking the text into a list of words, scientific terms (more on that below), and punctuation marks.
So for example, I expect the text "hello, world." to break into 4 tokens: 1) "hello"; 2) comma; 3) "world" and 4) pe...
I create a subprocess using subprocess.Popen() that runs for a long time. It is called from its own thread, and the thread is blocked until the subprocess completes/returns.
I want to be able to interrupt the subprocess so the process terminates when I want.
Any ideas?
...
Hello,
I am trying to get the mercurial revision number/id (it's a hash not a number) programmatically in python.
The reason is that I want to add it to the css/js files on our website like so:
<link rel="stylesheet" href="example.css?{% mercurial_revision "example.css" %}" />
So that whenever a change is made to the stylesheet, it ...
Hello,
I'm learning C++, because it's a very flexible language, but for internet things like Twitter, Facebook, Delicious and others, Python is so much more better, then i want to know if it's possible to integrate C++ and Python in a same project. Thanks!
...
I'm very new to Python in general, but I made an app in Python 2.6 / wxPython 2.8 that works perfectly when I run it through Python. But I wanted to go a step further and be able to deploy it as a Windows executable, so I've been trying out py2exe. But I haven't been able to get it to work. It would always compile an exe, but when I actu...
I have came up with this:
[a for a in dir(__builtins__) if str(type(getattr(__builtins__,a))) == "<type 'builtin_function_or_method'>"]
I know its ugly. Can you show me a better/more pythonic way of doing this?
...
I am having some issues with the size of qt4 widgets when their content changes.
I will illustrate my problems with two simple scenarios:
Scenario 1:
I have a QLineEdit widget. Sometimes, when I'm changing its content using QLineEdit.setText(), the one-line string doesn't fit into the widget at its current size anymore. I must select ...
Has anyone used SQLAlchemy in addition to Django's ORM?
I'd like to use Django's ORM for object manipulation and SQLalchemy for complex queries (like those that require left outer joins).
Is it possible?
Note: I'm aware about django-sqlalchemy but the project doesn't seem to be production ready.
...
Hi,
Part of my script is taking values and putting them to a text file delimited by tabs. So I have this:
for linesplit in fileList:
for i in range (0, len(linesplit)):
t.write (linesplit[i]+'\t')
I get as an output in the file what I expect in the first line but in the following lines they all start with a \t in them, lik...
Hi Everybody,
I am new to Python and new to SciPy libraries. I wanted to take some ques from the experts here on the list before dive into SciPy world.
I was wondering if some one could provide a rough guide about how to run two stats functions: Cumulative Distribution Function (CDF) and Probability Distribution Function (PDF).
My use...
I want a list full of the same thing, where the thing will either be a string or a number. Is there a difference in the way these two list are created? Is there anything hidden that I should probably know about?
list_1 = [0] * 10
list_2 = [0 for i in range(10)]
Are there any better ways to do this same task?
Thanks in advance.
...
Hello,
I have a python project, 'myproject', that contains several packages. one of those packages, 'myproject.settings', contains a module 'myproject.settings.local' that is excluded from version control via 'svn:ignore' property.
I would like setuptools to ignore this file when making a bdist or bdist_egg target.
I have experimented...
So I am trying to use the Cheetah templating engine in conjunction with the Django web framework, and that is actually working fine. I did some simple tests with that and I was able to render pages and whatnot.
However, problems arise whenever doing anything other than using very simple variable/attribute/methods in the Cheetah templat...
I'd like to write a code generation tool that will allow me to create sourcefiles for dynamically generated classes. I can create the class and use it in code, but it would be nice to have a sourcefile both for documentation and to allow something to import.
Does such a thing exist? I've seen sourcecodegen, but I'd rather avoid messin...
What's the easiest way to check if my program is already running with WxPython under Windows? Ideally, if the user tries to launch the program a second time, the focus should return to the first instance (even if the window is minimized).
This question is similar but the answer is for VB.NET.
...
So I have a class, specifically, this:
class ProductVariantForm_PRE(ModelForm):
class Meta:
model = ProductVariant
exclude = ("productowner","status")
def clean_meta(self):
if len(self.cleaned_data['meta']) == 0:
raise forms.ValidationError(_(u'You have to select at least 1 meta attribute.'))...