python-3.x

Python - Virtualenv , python 3?

Seems everyone recommends virtualenv for multiple python versions (on osx), but does it even work with python 3.0? I downloaded it, and it doesn't seem to.. And I don't really understand how it works, Can you 'turn on' on env at a time or something? What I want is to leave the system python 2.5 (obviously), and to have python 3.1.1 with ...

web framework compatible with python 3.1 and py-postgresql

I have started learning Python by writing a small application using Python 3.1 and py-postgresql. Now I want to turn it into a web application. But it seems that most frameworks such as web-py, django, zope are still based on Python 2.x. Unfortunately py-postgresql is incompatible with Python 2.x. Do I have to rewrite all my classes an...

Converting 2.5 byte comparisons to 3

I'm trying to convert a 2.5 program to 3. Is there a way in python 3 to change a byte string, such as b'\x01\x02' to a python 2.5 style string, such as '\x01\x02', so that string and byte-by-byte comparisons work similarly to 2.5? I'm reading the string from a binary file. I have a 2.5 program that reads bytes from a file, then compare...

Python 3 and open source: Are there any good projects?

I've been studying Python 3 recently and I have come across a conundrum: I want to expand my abilities by working on an open source project, but I seem to have trouble finding any specifically for Python 3. I know that this question has been asked before: Such as here, And here, Unfortunately these all seem to be using Python <= 2.6 and...

How does exec work with locals?

I thought this would print 3, but it prints 1: def f(): a = 1 exec("a = 3") print(a) ...

How to use COM objects in Python 3.x ?

I want to access COM objects using Python 3.1, but I can't find a library to support 3.x. Do I need to use some extension or there is something in the standard library? ...

BitString error on Windows XP?

Scott, I'd like to thank you for your BitString program. I am working on interpreting data from a neutron detector, and I've found that this module is just the tool I need. Unfortunately, I have yet to get the module to successfully pass test-bitstring.py. I'm running Windows XP and Python 3.1. I've downloaded your file bitstring-0.4...

`xrange(2**100)` -> OverflowError: long int too large to convert to int

xrange function doesn't work for large integers: >>> N = 10**100 >>> xrange(N) Traceback (most recent call last): ... OverflowError: long int too large to convert to int >>> xrange(N, N+10) Traceback (most recent call last): ... OverflowError: long int too large to convert to int Python 3.x: >>> N = 10**100 >>> r = range(N) >>> r = r...

Is there any framework like RoR on Python 3000?

One of the feature I like in RoR is the db management, it can hide all the sql statement, also, it is very easy to change different db in RoR, is there any similar framework in Python 3000? ...

Writing Cocoa applications in Python 3

It looks like PyObjC is not ported to Python 3 yet. Meanwhile is there a way to write Cocoa applications using Python 3? I am intending to start a new MacOSX GUI application project and though5 would want to use Python 3.x instead of Python 2.x. ...

Werkzeug in General, and in Python 3.1

I've been looking really hard at all of the way**(s)** one can develop web applications using Python. For reference, we are using RHEL 64bit, apache, mod_wsgi. History: PHP + MySQL years ago PHP + Python 2.x + MySQL recently and current Python + PostgreSQL working on it We use a great library for communicating between PHP and Pytho...

Python 3.1 RSS Parser?

Anyone know of a good feed parser for python 3.1? I was using feedparser for 2.5 but it doesn't seem to be ported to 3.1 yet, and it's apparently more complicated than just running 2to3.py on it. Any help? ...

Is there any way to affect locals at runtime?

I actually want to create a new local. I know it sounds dubious, but I think I have a nice use case for this. Essentially my problem is that this code throws "NameError: global name 'eggs' is not defined" when I try to print eggs: def f(): import inspect frame_who_called = inspect.stack()[1][0] frame_who_called.f_locals['egg...

Does a Python 3 SOAP client module exist?

I couldn't find one that works with Python 3.1. Any suggestions for a WSDL-consuming Python 3 SOAP client module/library? ...

Python 3.1.1 with --enable-shared : will not build any extensions

Summary: Building Python 3.1 on RHEL 5.3 64 bit with --enable-shared fails to compile all extensions. Building "normal" works fine without any problems. Please note that this question may seem to blur the line between programming and system administration. However, I believe that because it has to deal directly with getting language s...

A database for python 3?

I'm coding a small piece of server software for the personal use of several users. Not hundreds, not thousands, but perhaps 3-10 at a time. Since it's a threaded server, SQLite doesn't work. It complains about threads like this: ProgrammingError: SQLite objects created in a thread can only be used in that same thread.The object was ...

Dynamically importing modules in Python3.0?

I want to dynamically import a list of modules. I'm having a problem doing this. Python always yells out an ImportError and tells me my module doesn't exist. First I get the list of module filenames and chop off the ".py" suffixes, like so: viable_plugins = filter(is_plugin, os.listdir(plugin_dir)) viable_plugins = map(lambda name: nam...

Python 3.X ready... when?

When will be Python 3.x ready for serious production? I'm thinking mainly in web apps. I have been programming with the 3.x using only the "batteries included" and all works just fine, but I am forced to go back to 2.x when I have to make any serious work in the web (eg, django and/or google app engine). I am primarily interested in thes...

How do I make these relative imports work in Python 3?

I have a directory structure that looks like this: project/ __init__.py foo/ __init.py__ first.py second.py third.py plum.py In project/foo/__init__.py I import classes from first.py, second.py and third.py and put them in __all__. There's a class in first.py nam...

Python: Do relative imports mean you can't execute a subpackage by itself?

I've recently ported my Python project to run on Python 3.1. For that I had to adopt the policy of relative imports within the submodules and subpackages of my project. I've don’t that and now the project itself works, but I noticed I can't execute any of the subpackages or submodules in it. If I try, I get "builtins.ValueError: Attempte...