python

Given handle and tweet, find tweet ID

Hello Everyone, Sorry if this is a noob question, but I was looking into the twitter api, using tweepy for python, and noticed that a lot of the functions require the tweet id of a tweet. If I know a twitter handle and the tweet by that handle how can i use the twitter api to find the tweet id associated with that specific tweet? ...

Facebook python authentication example gives grey screen

I am trying to run facebook python sdk example for user authentication, but the example sends me to a greyed out screen, like this example. While I find it strange that facebook's own application does not work, I wonder how can I fix this problem. ...

Tree matching algorithm?

I am working on a tree library, and part of the required functionality, is to be able to search a node for child nodes that match a pattern. A 'pattern' is a specification (or criteria) that lays out the structure, as well as attributes of nodes in the subtree(s) to be matched. For example, suppose a tree represents data regarding a pa...

regular expression - incremental replacement

Hi All, Is there any way to do integer incremental replacement only with regex. Here is the problem, I have text file containing 1 000 000 lines all starting with % I would like to have replace # by integer incrementally using regex. input: % line one % line two % line three ... output: 1 line one 2 line two 3 line three .....

Alternatives to my slow method of using BeautifulSoup and Python to parse Amazon API XML?

As the title says, I'm using the BS module in Python to parse XML pages that I access from the Amazon API (i create the signed url, load it with liburl2, and then parse with BS). It takes about 4 seconds to do two pages, but there has to be a faster way Would PHP be faster? What's making it slow, the BS parsing or the liburl loading? ...

sending instant messages through python (msn)

ok I am well aware there are many other questions about this, but I have been searching and have yet to find a solid proper answer that doesnt revolve around jabber or something worse. (no offense to jabber users, just I don't want all the extras that come with it) I currently have msnp and twisted.words, I simply want to send and recei...

Python+Scipy+Integration: dealing with precision errors in functions with spikes

Hi, I am trying to use scipy.integrate.quad to integrate a function over a very large range (0..10,000). The function is zero over most of its range but has a spike in a very small range (e.g. 1,602..1,618). When integrating, I would expect the output to be positive, but I guess that somehow quad's guessing algorithm is getting confus...

Emulate SSH sever for testing purposes

I have to write test for deployment script which uploads files through SSH, but I'd like to have it not depending on external servers configuration. This is how i see it: Create 2 SSH daemons without authenication on different ports of loopback interface. Run the deployment script on these two ports The only question is how to run th...

migrating django 1.1.1 -> 1.2.1: {% url %} doesn't work

I am migrating a django project from 1.1.1 to 1.2.1 Now neither the {% url %} tag works nor the @models.permalink-decorated get_absulute_url works i.e. I get TemplateSyntaxError at / Caught TypeError while rendering: __init__() got an unexpected keyword argument 'error_message' for <li><a href="{% url archive_talks %}">talks</a></...

is it possible to connect a href link in QTextBrowser to a slot?

is it possible to connect a href link in QTextBrowser to a slot? I want to make something that looks like a link in a QTextBrowser, but when user clicked on it, it will call one of the methods. Is that possible? if that is not, what is a good alternative? Thanks in advance. ...

Remote coding and execution with python: what IDE ?

I have been developing a project in python for the last six months, and love the language. But I have yet to find an IDE or text editor that could provide some extra functionality for me. I currently have syntax highlighting which is one of the easiest things to get, but not much more. I am dreaming of having my IDE jump to the line in m...

Using pySerial to connect to a non-COM port

In Hyperterminal I am able to connect to a serial port called "X64-CL_iPro_1_Serial_0" where I am able to send/receive ASCII text to a camera. However when I try to connect to the same port with pySerial, it throws an exception: SerialException: could not open port X64-CL_iPro_1_Serial_0: [Error 2] The system cannot find the file specif...

Organizing multiple Python applications and shared library packages

Suppose that I am writing two applications for my employer, we'll call them App1 and App2. These applications depend on some packages containing code needed by both. Let's say that App1 depends on PackageA and PackageB. App2 depends on PackageB and PackageC. The organizing strategy that seems natural to me would be to check everything in...

Python unicode problems on Windows XP

Having the following django view code that generates a CSV response from a database view: def _get_csv_stats(request, **filterargs): result = GlobalStats.objects.select_related().filter(**filterargs).values_list('user__username', 'user__first_name','use...

How do I call a Python/Perl script in bin folder from a Bash script?

I previously used to copy Python/Perl scripts to access from my bash script. Duplication is not a good idea I know! Is there a way to call them from bin or libs folder that we have set up? For instance : My python script resides in /home/ThinkCode/libs/python/script.py My bash script resides in /home/ThinkCode/NewProcess/ProjectA/run...

What does it mean when a package is installed as "non-active development"?

For whatever reason, my build system isn't installing one of my packages properly. When I use yolk (from within a virtualenv), I get the following: bin/yolk -l elig elig - 3.1.2.dev - non-active development (/home/jason/src/interface_dev/elig) How exactly does a package go from active development to non-active developme...

select and ssl in python

I've got a server application using select.select(), and now I'm trying to add SSL to it, however I get the following error when listening to the "raw" sockets: ValueError: file descriptor cannot be a negative integer (-1) so I figured I'd use the ssl streams returned by ssl.wrap_socket in select instead. Doing so, it doesn't return a...

Compress XML column in Sqlite with Python is SLOW!

I'm new to Python and Sqlite, so I'm sure there's a better way to do this. I have a DB with 6000 rows, where 1 column is a 14K XML string. I wanted to compress all those XML strings to make the DB smaller. Unfortunately, the script below is much, much slower than this simple command line (which takes a few seconds). sqlite3 weather.db ....

what is the system function in python

I want to play with system command in python . for example we have this function in perl : system("ls -la"); and its run ls -la what is the system function in python ? Thanks in Advance . ...

Split field to array when accessed

I have Django model that looks like this: class Categories(models.Model): """ Model for storing the categories """ name = models.CharField(max_length=8) keywords = models.TextField() spamwords = models.TextField() translations = models.TextField() def __unicode__(self): return self.name clas...