python

Implement SMPP in Python

Good day. Have you ever heard of really working python-libraries for the realization of the SMPP client and the SMPP server? ...

JustHost.com and Python CGI

I'm trying to get justhost.com to compile a python CGI script (helloworld.py) without much luck. The site says python works, but I can't find much. I'm using webpython.codepoint.net/cgi_tutorial Has anyone gotten it to work? ...

Displaying log data in latest-first format

I like having log data in a last-first form (the same way most blogs and news sites organize their posts). The languages I'm most comfortable in are C++ and Python: is there a way to output log data either to the screen (stdout) or a file with the most recent entry always being on top? Or is there perhaps a way of modifying tail to sho...

Is TKinter widely used to build user interfaces ?

In which kind of application is TKinter usually used ? I'm doing a project in python in which I'm using it for the first time to build a simple user interface. I was wondering if this is widely used for specific applications, or mobile applications.. etc thanks ...

How do I return a list as a variable in Python and use in Jinja2?

I am a very young programmer and I am trying to do something in Python but I'm stuck. I have a list of users in Couchdb (using python couchdb library & Flask framework) who have a username (which is the _id) and email. I want to use the list of email addresses in a select box in a jinja2 template. My first problem is how to access the e...

Python - List Mapping

Hey, I have several lists that I would like to map together, but I can't quite work my head around how to do it. I am scraping a live feed of Horse Racing results. The feed only lists the course/time once and three horses and their positions (top three) OR four horses and blank (i.e. "") positions IF the race was abandoned. These are t...

Problems trying to access to a global var

Hi, I know how to use the global variables when they are defined in a class, but I have a global variable in a main. If I want to use it inside a class, which would be the import to access it? My main is something like this Main.py: from EvolutionaryAlgorithm import EvolutionaryAlgorithm initialTimeMain = 0 if __name__ == '__main__':...

Which university is offering video courses in programming languages?

Frankly speaking. I'm looking for a specific video course webpage which I visited few months ago. It was posted as an answer to some question. I know this kind of questions are frowned upon and closed. But I'm helpless. I've been searching for it for more than a month and this is my last approach. I'm writing a report on education metho...

How to use FTPlib in python

i'm writing an application that is supposed to upload a file to an FTP server. Here's the code: try: f = open(filename,"rb") except: print "error 0" try: ftp = FTP(str(self.ConfigUri)) print "CONNECTED!" except: print "CANNOT CONNECT" try: ftp = FTP(str(self.ConfigUri)...

See this example on webcam capturing in python

When I run this script on my machine ( ubuntu 10.04 32 bit ): http://pygstdocs.berlios.de/pygst-tutorial/webcam-viewer.html I click on "Start" button and then I get this error: # python example-webcam.py example-webcam.py: Fatal IO error 0 (Success) on X server :0.0. Why ? ...

How to loop all image pixels and tell whether they are black or white

I have a simple black and white only gif image (400x400px let's say). I need to get all pixels from that image and find whether they are black or white. I need to create a dictionary with the information about the pixels and their colors then. I'm pretty new to python so I am kinda struggling with this. But here goes my script so far: ...

static method as default parameter to a class method

My question is about two answers to another question: http://stackoverflow.com/questions/3083692/using-class-static-methods-as-default-parameter-values-within-methods-of-the-same. I am trying to understand if there's really a difference between what the two answers do, and if so, what's the pros and cons of each. Question: how to use ...

can you flag command line inputs in python?

a lot of command-line .exe applications i use allow you flag optional inputs e.g. program.exe -o outputfile.txt -f F where "-o" indicates an optional output file name different to the default, and where "-F' indicates another option about the script. so far i've been using the sys.arg[] variables to input file names and such to my pyth...

Reordering python list based on an algorithm or pattern

Here is a stumper for you math geeks out there. I have a python list that is just a sequence that looks like this: myList=[1,2,3,4,5,6,7,8,9,10,11,12,13,(...etc...),43] Unfortunately, the data from which the list was generated was not zero-padded, and it should have been. So in reality: 1==1 2==10 3==11 4==12 5==13 6==14 7==15 8=...

Inheritance in Java

Consider the following code in Python: class A(object): CLASS_ATTRIBUTE = 42 def f(self): return "CLASS_ATTRIBUTE: %d" % self.CLASS_ATTRIBUTE class B(A): CLASS_ATTRIBUTE = 44 Now A().f() and B().f() return "CLASS_ATTRIBUTE: 42" and "CLASS_ATTRIBUTE: 44" respectively. How can I achieve a similar effect in Java? I...

All possible paths from one node to another in a directed tree (igraph)

I use python binding to igraph to represent a directed tree. I would like to find all possible paths from one node in that graph to another one. Unfortunately, I couldn't find a ready to use function in igraph that performs this task? EDIT The concerns on infinite number of paths the graph I'm talking about is actually a directed ac...

Suggestions for writing this small piece of code more elegantly

Although it looks terrible, I am not finding a nicer/more efficient way of doing this: ae = np.arange(0.0,1,0.05) aee = np.arange(0.3,1.01,0.345) aef = np.arange(0.3,1.01,0.345) random.shuffle(ae) random.shuffle(aee) random.shuffle(aef) for item_a in aee: for item_b in ae: for item_c in aef: rlist.append(...

Metrics on "market share" for server-side scripting languages

Hi all, Does anyone know of any market share information for server-side scripting languages (# of web servers, % of web servers, etc.)? I'm learning how to do server-side scripting with Python (via the examples in Programming Python). I just can't ever remember having seen a web address with ".py?" in it ... they're almost all ".php?"...

In Python, identify parts of an e-mail address

Given a list of e-mail addresses: list = ('First Last <[email protected]>' , '[email protected]') some of which contain first and last name, others which just contain an e-mail address, how can I loop through the list and extract a first and last name (if they exist), and the email address? Thanks. ...

FK not populating in django form

Hello everyone. I have a small question to ask the community. I am wondering why my foreign key will not show up when I go to my edit form. When I go to edit the information, all my data is populated except for status (which is a foreignkey that points from the status table to project table), which is left with nothing selected. I ...