Hey guys I'm new to Mac so please bear with me.
I'm using snow leopard 10.6.4 at the moment.
I want to install numpy and scipy, so I downloaded the python2.6,numpy and scipy dmg files from their official site. However, I'm having problem import numpy:
Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy/core/multiarray.so: no matching architecture in universal wrapper
Can anyone shed some light to this problem?
Recently came across pidgin. Its great, and does what I want, but I am not too keen on the GPL license. Other any alternatives, with less restrictive licenses?
I would prefer the library to be C or C++, as I am most familiar with those languages, but a an IM library implemented in python would be interesting too.
When I was using the built-in simple server, everything is OK, the admin interface is beautiful:
python manage.py runserver
However, when I try to serve my application using a wsgi server with django.core.handlers.wsgi.WSGIHandler, Django seems to forget where the admin media files is, and the admin page is not styled at all:
gunicorn_django
How did this happen?
My input string is '16-MAR-2010 03:37:04' and i want to store it as datetime.
I am trying to use:
db_inst.HB_Create_Ship_Date = datetime.strptime(fields[7]," %d-%b-%Y %H:%M:%S ")
fields[7] = '16-MAR-2010 03:37:04'
I am getting an error:
::ValueError: time data '16-MAR-2010 03:37:04' does not match format ' %d-%b-%Y %H:%M:%S '
I am running Python version --EDIT-ME-- on the --EDIT-ME-- operating system.
My locale is --EDIT-ME--.
Which format do I have to use?
Dear all,
I need to generate a vector of random float numbers between [0,1] such
that their sum equals 1 and that are distributed non-uniformly.
Is there any python function that generates such a vector?
Best wishes
I have multiple Network Interface Cards on my computer, each with its own IP address.
When I use gethostbyname(gethostname()) from Python's (built-in) socket module, it will only return one of them. How do I get the others?
Python newb here. I m trying to count the number of letter "a"s in a given string. Code is below. It keeps returning 1 instead 3 in string "banana". Any input appreciated.
def count_letters(word, char):
count = 0
while count <= len(word):
for char in word:
if char == word[count]:
count += 1
return count
print count_letters('banana','a')
I know about the LEGB rule. But a simple test of whether a function has read access to variables defined in an enclosing function doesn't seem to actually work. Ie:
#!/usr/bin/env python2.4
'''Simple test of Python scoping rules'''
def myfunction():
print 'Hope this works: '+myvariable
def enclosing():
myvariable = 'ooh this worked'
myfunction()
if __name__ == '__main__':
enclosing()
Returns:
NameError: global name 'myvariable' is not defined
Am I doing something wrong? Is there more to it than the LEGB resolution order?
i want my thread to sleep when a queue is empty and just wake up when a data is put in it,
should i use condition object? i have never used this object before! and i can,t find a simple example in python
I'd like to list the items in a tuple in Python starting with the back and go to front.
Similar to:
foo_t = tuple(int(f) for f in foo)
print foo, foo_t[len(foo_t)-1] ...
I believe this should be possible without Try ...-4, except ...-3.
Thoughts? suggestions?
I have some structure in Python:
gender=( ('0','woman'), ('1','man') )
I want translate it before I will display it in Django template.
Unfortunatelly below sollution don't work:
from django.utils.translation import
ugettext_lazy as _
gender=( ('0',('woman')),
('1',('man')) )
What I must do to translate this.
I readed something in:
link text
but I can't understand what I should do.
As an ASP.NET developer, I'm used to working with how VS/C# transparently autogens proxy classes for web references (yes, I know, we're spoiled), but now that I'm creating documentation for more than one coding platform I'm trying to discover what the equivelant to that is in any other framework.
So is there a similar way to work transparently with web reference proxy classes for say, RoR, PHP, and Python?
And if there's nothing integrated, are there tools you recommend to autogen the proxy classes, or do you recommend to roll custom classes?
With python inotifyx, do I have to remove watch and close opened system file descriptor if I need them until program exit? E.g. is there some possible problems if I create one (file descriptor + watch) with each run and don't close it?
In python zip function accepts arbitrary number of lists and zips them together.
>>> l1 = [1,2,3]
>>> l2 = [5,6,7]
>>> l3 = [7,4,8]
>>> zip(l1,l2,l3)
[(1, 5, 7), (2, 6, 4), (3, 7, 8)]
>>>
How can I zip together multiple lists in haskell?
i saw this phrase in python 2.6 man:
class threading.Thread(group=None, target=None, name=None, args=(), kwargs={})
.
.
.
If the subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.
i just wanna know why?
For example in Java for Data Transfer Object I use as:
ExampleDTO exampleDTO = new ExampleDTO();
What naming convention should I follow for similar in Python?
I'm using Windows 7 Pro and I made a C# program that makes Speech Recognition.
When I run the program, the Speech Recognition App initializes.
Now, how can I turn it on ("Listen to everything I say") and minimize it (so it goes to systems tray and isn't visible), using C# or Python?
I want to print that the all possibilities of a number that occurs interchanging the digits in a number?
I want to print that the all possibilities of a number that occurs interchanging the digits in a number?
Suppose a number 1234 it have 24 possibilities 4!=24
123 have 6 possibilities 3!=6
123
132
213
231
312
321
i want these numbers as output
please tell me the structure of this program in the python
When it comes to TTS (text-to-speech) libraries in Linux, what choices do developers have?
What libraries ship with the majority of distros?
Are there minimal libraries? What functionality does each library offer?
I'm approaching this primarily from a C++ point of view, although Python would suit me too.
i try to write this code to process Arabic language by python
import codecs
file = codecs.open("C:\Python27\CCA_raw_utf8.txt","r","utf-8")
text= file.read()
####################################
print "\n "," --------------------------------------------"
text=text[1:]
words=text.split()
for w in words:
if w == unicode ("?????","utf-8"):
print w
but it doesn't and take error " if w == unicode ("?????","utf-8"):
UnicodeDecodeError: 'utf8' codec can't decode byte 0xc7 in position 0: invalid continuation byte "
why program gives this result and how we can correct that??
I'm using python to develop an app and want to view running processes.The code
txt = commands.getoutput("top -d 1")
print txt
gives an error "TERM Environment Variable not set"
Can someone tell me what this means and how to solve this
Is there any difference between:
if foo is None: pass
and
if foo == None: pass
The convention that I've seen in most Python code (and the code I myself write) is the former, but I recently came across code which uses the latter. None is an instance (and the only instance, IIRC) of NoneType, so it shouldn't matter, right? Are there any circumstances in which it might?