pdb and winpdb both seem to be missing this essential (to me) feature. I saw something suggesting WingIDE has it but I'd prefer a solution that is free, and if I do have to pay, I'd prefer to pay for something that is better than Wing.
I'd like to be able to do:
>>> class a(str):
... pass
...
>>> b = a()
>>> b.__class__ = str
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: __class__ assignment: only for heap types
I'm having trouble understanding the result of the following statements:
>>> from array import array
>>> array('L',[0xff,0xff,0xff,0xff])
array('L', [255L, 255L, 255L, 255L])
>>> from array import array
>>> array('L','\xff\xff\xff\xff')
Traceback (most recent call last):
File "<stdin>", line 1, in…
When is Python 3.1 meant to become mainstream Python version? How many years are to pass before Python 3.1 support and adoption grows any close to of today Python 2.6?
I am making a project where I need several modules which are imported into one main module to make a pizza ordering service. Upon finishing this (to a working standard) I decided to re-code it so that the whole order is completed with one tkinter window, now instead of using input(), I use tkinter.Entry() etc. etc.
To do this I had to use…
I want to run a csh file from a python scrip,
example,
#!/usr/bin/python
import os
os.system("source path/to/file.csh")
and I want this file to run in the same shell as I am running the python script, because the file.csh script is settings some environment variables that I need.
Does anyone know how to do this in Python?
I'm trying to install the module mySQLdb on a windows vista 64 (amd) machine.
I've installed python on a different folder other than suggested by Python installer.
When I try to install the .exe mySQLdb installer, it can't find python 2.5 and it halts the installation.
Is there anyway to supply the installer with the correct python…
Please see the following code:
def good():
foo[0] = 9 # why this foo isn't local variable who hides the global one
def bad():
foo = [9, 2, 3] # foo is local, who hides the global one
for func in [good, bad]:
foo = [1,2,3]
print('Before "{}": {}'.format(func.__name__, foo))
func()
print('After "{}":…
I'm having trouble understanding the result of the following statements:
>>> from array import array
>>> array('L',[0xff,0xff,0xff,0xff])
array('L', [255L, 255L, 255L, 255L])
>>> from array import array
>>> array('L','\xff\xff\xff\xff')
Traceback (most recent call last):
File…
how to call a server side python script from javascript. if test.py is the python script file in server, and if the parameter to be passed to python is another url , then how this can be executed from javascript, how the return string from python script is obtained to the javascript.
How can I replace a string with another string, within a given text file. Do I just loop through readline() and run the replacement while saving out to a new file? Or is there a better way?
I'm thinking that I could read the whole thing into memory, but I'm looking for a more elegant solution...
Thanks in…
With jquery it's very easy to insert some element inside another element using the selector technology, I am wondering if there is any python library that can do things similar with jquery, the reason is I want server side python program to produce the static pages, which needs to parse the html and insert…
I am a web developer and usually use php/JS/mysql.
I have heard lot about python.
I have no idea where is python used and why it is used.
Just like
php/asp/cold fusion/.net/
are used to build websites
C, C++ , Java
are used to build software or desktop apps
Where does python stands from those…
I already posted this, but here is the exact code:
x1 = input("")
x2 = input("-")
x3 = input("-")
x4 = input("-")
So, how would I do it so that there are no spaces between the first input and the next "-"?
Example:
1234-5678-9101-1121
Hi all,
We are using Carrot in our Python project. I wrote a Python script acting as the consumer of the message queue. I invoked this Python script using command line shell in Windows 7 as
python consumer.py
However, after a while, the running session was aborted and the error is:
[errno 10054]…
In 2.6, if I needed to accept input that allowed a percent sign (such as "foo % bar"), I used raw_input() which worked as expected.
In 3.0, input() accomplishes that same (with raw_input() having left the building).
As an exercise, I'm hoping that I can have a backward-compatible version that will…
I have a batch script using Windows shell commands to perform several administrative actions.
The script is running great on Windows 7 but when i try launching it from Python 2.6 nothing happens:
import os
a = os.popen("somebatchfile.bat")
I assume that this is because the bat file uses several…
I am trying to create python bindings to a vala library using the following IBM tutorial as a reference.
My initial directory has the following two files:
test.vala
using GLib;
namespace Test {
public class Test : Object {
public int sum(int x, int y) {
return x + y;
…
I started by trying to store strings in sqlite using python, and got the message:
sqlite3.ProgrammingError: You must
not use 8-bit bytestrings unless you
use a text_factory that can interpret
8-bit bytestrings (like text_factory =
str). It is highly recommended that
you instead just…
I started by trying to store strings in sqlite using python, and got the message:
sqlite3.ProgrammingError: You must
not use 8-bit bytestrings unless you
use a text_factory that can interpret
8-bit bytestrings (like text_factory =
str). It is highly recommended that
you instead just…
Ok so I need to create a bunch of utility classes in python. Normally I would just use a simple module for this but I need to be able to inherit in order to share common code between them. The common code needs to reference the state of the module using it so simple imports wouldn't work well. I…
In initially installed yum install mod_wsgi and i think it was linked with python 2.6
Now is there any way to link it with 2.7
I tried configuring from the source and i get this error
apxs -c -I/usr/local/include/python2.7 -DNDEBUG mod_wsgi.c -L/usr/local/lib…
I keep trying to install django and other python packages, and I keep getting the exact same error message:
Installing django-admin.py script to /usr/local/bin
error: /usr/local/bin: File exists
So I look to make sure that my /usr/local folder is okay. At first…