Hello all,
I recently installed Boost using MacPorts, with the intent to do some Python embedding in C++. I then decided to check if I configured Xcode correctly with an example found on Python's website:
#include <boost/python.hpp>
using namespace boost::python;
int main( int argc, char ** argv )
{
try
{
Py_Initial...
I'm trying to compile to an exe my script of python, but I'm getting an error that I'm not know how to resolve...
my script include this libraries
import pyHook
import pythoncom
import time
import win32com.client
and the py2exe script is
from distutils.core import setup
import py2exe
import sys
sys.argv.append('py2exe')
setup(
...
I've been working on a python script to open up a file with a unicode name (Japanese mostly) and save to a randomly generated (Non-unicode) filename in Windows Vista 64-bit, and I'm having issues... It just doesn't work, it works fine with non-unicode filenames (Even if it has unicode content), but the second you try to pass a unicode fi...
Hello! I have been working on a program where I need to slowly and smoothly change the pitch of a sine wave from one pitch to another. I am able to get an array of the frequency the pitch should be at any given moment (for instance, [440, 526.5, 634.2 794.8, 880], though much, much longer) but it seems I am unable to actually apply tha...
I'd like to know where the module I'm about to import is coming from. Is there a which command in python?
Example:
>>> which module_name
/usr/lib/python2.6/site-packages/module_name.py
...
I'm wondering if there is any easy way or function to determine the greatest number in a set of numbers. I could just code it, as I only have three numbers, however it would make the code a lot less redundant if I could tell the greatest with a built in function or something.
...
go = Content.objects.get(name="baby")
# go should be None, since nothing is in the database.
...
i had prepared a project on making a software application. It is complete and working fine except that the speed of execution is very slow..i have taken several chunks of code and optimized it..
i tried psyco..ie i installed psyco and added two lines on the top of my code
import psyco
psyco.full()
Don't know whether this is the way usi...
I have a python scripts that does some jobs. I use multiprocessing.Pool to have a few workers do some commands for me.
My problem is when I try to terminate the script. I would like when I press Ctrl-C, that every worker immediately cleans up it's experiment (which is some custom code, or actually even a subprocess command, not just rel...
in school we got this class file:
class Konto:
def __init__(self, nummer):
self.__nr = nummer
self.__stand = 0
self.__minimum = -1000.0
def getStand(self):
return self.__stand
def getNr(self):
return self.__nr
def einzahlen(self, betrag):
self.__stand = self.__stand + be...
Hi all,
I am trying to install python mysqldb in my mac but I got the following errors. For mysql I am using the one that is bundled with MAMP. Thanks!
here is the error message:
running build
running build_py
copying MySQLdb/release.py -> build/lib.darwin-8.11.1-i386-2.3/MySQLdb
running build_ext
building '_mysql' extension
gcc -fno-...
I have a similar question like the one asked here but I need it to work on OSX.
http://stackoverflow.com/questions/2625877/copy-files-to-nework-path-or-drive-using-python
So i want to save a file on a SMB network share. Can this be done?
Thanks!
...
I have a file whose contents are of the form:
.2323 1
.2327 1
.3432 1
.4543 1
and so on some 10,000 lines in each file.
I have a variable whose value is say a=.3344
From the file I want to get the row number of the row whose first column is closest to this variable...for example it should give row_num='3' as .3432 is closest to...
What does the +\ operator do in Python?
I came across this piece of code -
rows=urllib2.urlopen('http://ichart.finance.yahoo.com/table.csv?'+\
's=%s&d=11&e=26&f=2006&g=d&a=3&b=12&c=1996'%t +\
'&ignore=.csv').readlines( )
and can't find any references that explain it.
...
I have a db.StringProperty() mRegion that is set to some Korean text. I see in my Dashboard that the value is visibly in Korean like this:
한국 : 충청남도
However, when I take this field and add it into a string list property (db.StringListProperty()) I end up with something like this:
\ud55c\uad6d : \ucda9\uccad\ub0a8\ub3c4
I am having i...
I'm running PyS60 on a Nokia N95 phone, and I want to find a way of having my script interact with an application running in the background.
I found this http://wiki.forum.nokia.com/index.php/How_to_simulate_a_keypress_in_PyS60 .. but it doesn't mention anything about sending the keypresses to a specific target.
The reason I want to do...
I`m implementing a custom filesystem on Ubuntu using Fuse, but I need to trap when a copy or move operation occur. Right now all I see are when some file are opened for writing or reading, but I need to see these operations in context so I can see what file are being copied or moved.
Any hints?
...
I installed the latest versions of python (2.6.5), gtk+, pygtk (and friends) from their respective websites on Windows XP SP3. When you try to import gtk (or just glib for that matter), an ImportError is raised:
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "...
C and many other languages have a conditional (aka ternary) operator. This allows you to make very terse choices between two values based on the truth of a condition, which makes expressions, including assignments, very concise.
I miss this because I find that my code has lots of conditional assignments that take four lines in Python:
...
Hi,
I've installed and written the following Paramiko which is unable to put the file. It is easily able to 'get' a file and execute 'ls' commands on it.
#set username & password
username='runaway'
password='runaway'
port=22
source= '/Unzip.sh'
destination ='/var/mpx/www/http'
#SFTP
client.load_system_host_keys()
print " hostname =%s...