python

Does anyone know of source code for a web based study group?

I'm looking for source code for a web based study group. I'd prefer something in Python or C#. I have searched google but I'm finding mostly existing study groups on particular topics and not software to host an online study group. Can anyone help out? Edit: Ah, I was unfamiliar with the buzzwords "Learning Management System" or "Vi...

python class variable not visible in __init__?

This code produces an error message, which I found surprising: class Foo(object): custom = 1 def __init__(self, custom=Foo.custom): self._custom = custom x = Foo() Can anyone provide enlightenment? ...

Is this a sensible approach for an EBCDIC (CP500) to Latin-1 converter?

I have to convert a number of large files (up to 2GB) of EBCDIC 500 encoded files to Latin-1. Since I could only find EBCDIC to ASCII converters (dd, recode) and the files contain some additional proprietary character codes, I thought I'd write my own converter. I have the character mapping so I'm interested in the technical aspects. ...

how to convert a python dict object to a java equivalent object?

I need to convert a python code into an equivalent java code. Python makes life very easy for the developers by providing lots of shortcut functionalities. But now I need to migrate the same to Java. I was wondering what will the equivalent of dict objects in java? I have tried using HashMap but life is hell. For starters consider this, ...

I need a Python class that keep tracks of how many times it is instantiated

I need a class that works like this: >>> a=Foo() >>> b=Foo() >>> c=Foo() >>> c.i 3 Here is my try: class Foo(object): i = 0 def __init__(self): Foo.i += 1 It works as required, but I wonder if there is a more pythonic way to do it. ...

Tips on upgrading to python 3.0?

So with the final releases of Python 3.0 (and now 3.1), a lot of people are facing the worry of how to upgrade without losing half their codebase due to backwards incompatibility. What are people's best tips for avoiding the many pitfalls that will almost-inevitably result from switching to the next-generation of python? Probably a goo...

How do I satisfy a 3rd-party shared library reference to stat when I'm creating a shared library shim rather than an executable?

I am the new maintainer for an in-house Python system that uses a set of 3rd-party shared C libraries via a shared library shim that is created using a combination of swig and a setup.py script. This has been working well until recently. The 3rd-party shared C libraries were updated for new functionality and now I get the following run-...

Is this a correct way to return JSON in Python/GAE for parsing in JavaScript?

I am making an API for some AJAX related things in my web app on GAE in Python. After setting the content-type to 'application/json' and accessing my url directly- http://mysite.com/api?method=theMethod&param=firstParam -I am being prompted with a 'save file' dialog box instead of seeing the JSON object displayed. The file contain...

Use SQLite's backup API from Python/SQLAlchemy

I'm using an SQLite database from python (with SQLAlchemy). For performance reasons, I'd like to populate an in-memory database in the application, and then back up that database to disk. SQLite has a backup API, which seems would do this transparently. The APSW documentation says that it wraps the backup API, but I'd like to access th...

Learning Python for a .NET developer

I have been doing active development in C# for several years now. I primarily build enterprise application and in house frameworks on the .NET stack. I've never had the need to use any other mainstream high level languages besides C# for my tasks, since .NET is the standard platform we use. There are some legacy Python applications th...

see if two files are the same in python

Possible Duplicates: Finding duplicate files and removing them. In Python, is there a concise way of comparing whether the contents of two text files are the same? What is the easiest way to see if two files are the same in Python. One thing I can do is md5 each file and compare. Is there a better way? ...

Updating one aspect of a Pygame surface

I have an application written in python that's basically an etch-a-sketch, you move pixels around with WASD and arrow keys and it leaves a trail. However, I want to add a counter for the amount of pixels on the screen. How do I have the counter update without updating the entire surface and pwning the pixel drawings? ...

Python Language Question: attributes of object() vs Function

In python, it is illegal to create new attribute for an object instance like this >>> a = object() >>> a.hhh = 1 throws Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'object' object has no attribute 'hhh' However, for a function object, it is OK. >>> def f(): ... return 1 ... >>> f.hhh...

Playing MMS streams within Python

I'm writing a XM desktop application (I plan on releasing the source on github when I'm finished if anyone is interested) Anyway, the one part I know very little about is how to play media within Python (I'm using PyQt for the frontend). Basically, I have a mms:// url that I need to play. I was wondering if there is a library that could ...

Updating part of a surface in python, or transparent surfaces

I have an application written in python that's basically an etch-a-sketch, you move pixels around with WASD and arrow keys and it leaves a trail. However, I want to add a counter for the amount of pixels on the screen. How do I have the counter update without updating the entire surface and pwning the pixel drawings? Alternatively, can ...

How can I deal with No module named edit.editor ?

I am trying to follow the WingIDE tutorial on creating scripts in the IDE. This following example scripts always throws an error: import wingapi def test_script(test_str): app = wingapi.gApplication v = "Product info is: " + str(app.GetProductInfo()) v += "\nAnd you typed: %s" % test_str wingapi.gApplication.ShowMessageDialog(...

Is modifying a class variable in python threadsafe?

I was reading this question (which you do not have to read because I will copy what is there... I just wanted to give show you my inspiration)... So, if I have a class that counts how many instances were created: class Foo(object): instance_count = 0 def __init__(self): Foo.instance_count += 1 My question is, if I create Foo ...

Convert XSD to Python Class

Hy everybody, I just want to know if there is a programm that convert an XSD file to Python Class as JAXB does for Java ? Thant you. ...

date is added in background while adding time in datastore GAE

3.Why does "jan 1st 1970" gets added in the startime field in datastore when I am doing the below statements? (hour,min) = self.request.get('starttime').split(":") #if either of them is null or empty string then int will throw exception if hour and min : datastoremodel.starttime = datetime.time(int(hour), int(min)) Although when ...

user friendly framework for personal website ?

Hi, Which are the user friendly frameworks for building personal sites? Specially if that comes with little programming knowledge. And integrated jquery will be great. python or php based framework will do better. I tried wordpress and joomla! But those are far more complex for a simple personal site with personal blogging, live comment...