Search Results

Search found 15187 results on 608 pages for 'boost python'.

Page 30/608 | < Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >

  • Python server does not excecute PHP script: permission denied

    - by krisvandenbergh
    I am trying to execute a PHP file through a Python server. However, I get the following error: File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/CGIHTTPServer.py", line 255, in run_cgi os.execve(scriptfile, args, os.environ) OSError: [Errno 13] Permission denied The python server is running though. What have I done so far? Chmod'ed recursively all directories to (chmod -R a+x) (I know this is not secure but its just for testing purposes) for both Python installation directories and my scripts. Tried to find out if python server is running as root through ps aux grep py I am out of ideas. What could be going wrong else? Thanks for the feedback.

    Read the article

  • Installing TKInter for Python 2.6.5

    - by Azfar
    Well today's been a bit of shock. After running port -v selfupdate followed by an attempt to run sudo port install py26-ipython MacPorts went around installing a whole host of stuff, including updating my Python from 2.6.4 to 2.6.5. It's nice but unexpected in a creepy way. So I tried to install TKInter using MacPorts with port search tkinter yielding: py-tkinter @2.4.6 (python, graphics) Python bindings to the Tk widget set py25-tkinter @2.5.4 (python, graphics) This is a stub. tkinter is now built with python25 Found 2 ports. So I tried sudo port install py25-tkinter and then it tries to install Python 2.5.5. There must be an easier way to install TkInter without being faffed around... help please?

    Read the article

  • How to specify or add directory to Python.h search path during setup.py build/install

    - by ca2longoria
    I'm running Linux, and have downloaded a python module I must install without access to any but my particular /home/user directory (I have no root privileges nor the option to pursue them). This of course requires the Python source. This I've downloaded and have laying around in said user directory. While asking the admin to copy the proper files into /usr/include/python2.7 is the easiest way to go about this, I am hoping for a more general and portable solution to this kind of problem. Changing only data in the module source (MANIFEST.in, README.txt, setup.py, etc.), how might I add an arbitrary directory to the search path for Python.h and friends? (Without a solution, "python setup.py build" will continue returning with the "Python.h: No such file or directory" error) Thank you very much. (Additionally, is it acceptable to post this both here and on StackOverflow?)

    Read the article

  • Desktop file for my Python script

    - by Jason94
    I would like to make a .desktop file for my Python script, but so far the only thing i have is a clickable icon on my desktop! It does nothing when I click it, so im guessing there is something wrong with the execution :) The desktop file: [Desktop Entry] Version=1.0 Type=Python Exec=/home/user/MyDocs/Python/EasySteer/Main.py Name=EasySteer Icon=steering_wheel X-Icon-Path=/usr/share/icons and I also tried: [Desktop Entry] Version=1.0 Type=Application Exec=/usr/bin/xterm "python /home/user/MyDocs/Python/EasySteer/Main.py" Name=EasySteer Icon=steering_wheel X-Icon-Path=/usr/share/icons But nothing works :D if it matters this is for my Nokia N900 mobile phone that runs Maemo linux, but I think the basics are the same.

    Read the article

  • What are the packages/libraries I should install before compiling Python from source?

    - by Lennart Regebro
    Once in a while I need to install a new Ubuntu (I used it both for desktop and servers) and I always forget a couple of libraries I should have installed before compiling, meaning I have to recompile, and it's getting annoying. So now I want to make a complete list of all library packages to install before compiling Python (and preferably how optional they are). This is the list I compiled with below help and by digging in setup.py. It is complete for Ubuntu 10.04 and 11.04 at least: build-essential (obviously) libz-dev (also pretty common and essential) libreadline-dev (or the Python prompt is crap) libncursesw5-dev libssl-dev libgdbm-dev libsqlite3-dev libbz2-dev More optional: tk-dev libdb-dev Ubuntu has no packages for v1.8.5 of the Berkeley database, nor (for obvious reasons) the Sun audio hardware, so the bsddb185 and sunaudiodev modules will still not be built on Ubuntu, but all other modules are built with the above packages installed. Python 2.5 and Python 2.6 also needs to have LDFLAGS set on Ubuntu 11.04 and later, to handle the new multi-arch layout: export LDFLAGS="-L/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)" For Python 2.6 and 2.7 you also need to explicitly enable SSL after running the ./configure script and before running make. In Modules/Setup there are lines like this: #SSL=/usr/local/ssl #_ssl _ssl.c \ # -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ # -L$(SSL)/lib -lssl -lcrypto Uncomment these lines and change the SSL variable to /usr: SSL=/usr _ssl _ssl.c \ -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ -L$(SSL)/lib -lssl -lcrypto Python 2.6 also needs Modules/_ssl.c modified to be used with OpenSSL 1.0, which is used in Ubuntu 11.10. At around line 300 you'll find this: else if (proto_version == PY_SSL_VERSION_SSL3) self->ctx = SSL_CTX_new(SSLv3_method()); /* Set up context */ else if (proto_version == PY_SSL_VERSION_SSL2) self->ctx = SSL_CTX_new(SSLv2_method()); /* Set up context */ else if (proto_version == PY_SSL_VERSION_SSL23) self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */ Change that into: else if (proto_version == PY_SSL_VERSION_SSL3) self->ctx = SSL_CTX_new(SSLv3_method()); /* Set up context */ #ifndef OPENSSL_NO_SSL2 else if (proto_version == PY_SSL_VERSION_SSL2) self->ctx = SSL_CTX_new(SSLv2_method()); /* Set up context */ #endif else if (proto_version == PY_SSL_VERSION_SSL23) self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */ This disables SSL_v2 support, which apparently is gone in OpenSSL1.0.

    Read the article

  • How do I unescape HTML entities in a string in Python 3.1?

    - by Sho Minamimoto
    I have looked all around and only found solutions for python 2.6 and earlier, NOTHING on how to do this in python 3.X. (I only have access to Win7 box.) I HAVE to be able to do this in 3.1 and preferably without external libraries. Currently, I have httplib2 installed and access to command-prompt curl (that's how I'm getting the source code for pages). Unfortunately, curl does not decode html entities, as far as I know, I couldn't find a command to decode it in the documentation. YES, I've tried to get Beautiful Soup to work, MANY TIMES without success in 3.X. If you could provide EXPLICIT instructions on how to get it to work in python 3 in MS Windows environment, I would be very grateful. So, to be clear, I need to turn strings like this: Suzy &amp; John into a string like this: "Suzy & John".

    Read the article

  • When and why are you planning to upgrade to Python 3.0?

    - by Tomislav Mutak
    Python 3.0 (aka Python 3000, Py3k, etc) is now available. When and why are you planning on porting your project or code to the new Python? edit: I'm particularly interested in any features that don't exist in 2.6 that make porting worth it. Right now seems like a lot of negatives (x hasn't been ported yet), but I don't know what people see as the positives. Regarding "when", I'm interested in people's thoughts that the first step to porting is to have "excellent test coverage" which seems a bit optimistic for some projects.

    Read the article

  • Are there any Python reference counting/garbage collection gotchas when dealing with C code?

    - by Jason Baker
    Just for the sheer heck of it, I've decided to create a Scheme binding to libpython so you can embed Python in Scheme programs. I'm already able to call into Python's C API, but I haven't really thought about memory management. The way mzscheme's FFI works is that I can call a function, and if that function returns a pointer to a PyObject, then I can have it automatically increment the reference count. Then, I can register a finalizer that will decrement the reference count when the Scheme object gets garbage collected. I've looked at the documentation for reference counting, and don't see any problems with this at first glance (although it may be sub-optimal in some cases). Are there any gotchas I'm missing? Also, I'm having trouble making heads or tails of the cyclic garbage collector documentation. What things will I need to bear in mind here? In particular, how do I make Python aware that I have a reference to something so it doesn't collect it while I'm still using it?

    Read the article

  • How do I set sys.excepthook to invoke pdb globally in python?

    - by saffsd
    From Python docs: sys.excepthook(type, value, traceback)¶ This function prints out a given traceback and exception to sys.stderr. When an exception is raised and uncaught, the interpreter calls sys.excepthook with three arguments, the exception class, exception instance, and a traceback object. In an interactive session this happens just before control is returned to the prompt; in a Python program this happens just before the program exits. The handling of such top-level exceptions can be customized by assigning another three-argument function to sys.excepthook. http://docs.python.org/library/sys.html How do I modify this globally so the default action is to always invoke pdb? Is there a configuration file I can change? I don't want to wrap my code to do this.

    Read the article

  • 2D animation example in pyglet (python) looping through 2 images/sprites every x seconds

    - by Bentley4
    Suppose you have two images: step1.png and step2.png . Can anyone show me a very simple example in pyglet how to loop through those 2 images say every 0.5 seconds? The character doesn't have to move, just a simple black screen with a fixed region wherein the two images continually change every 0.5 secs. I know how to make a character move, shoot projectiles etc. but I just can't figure out how to control the looping speed of the images.

    Read the article

  • How to make an arc'd, but not mario-like jump in python, pygame [duplicate]

    - by PythonInProgress
    This question already has an answer here: Arc'd jumping method? 2 answers Analysis of Mario game Physics [closed] 6 answers I have looked at many, many questions similar to this, and cannot find a simple answer that includes the needed code. What i am trying to do is raise the y value of a square for a certain amount of time, then raise it a bit more, then a bit more, then lower it twice. I cant figure out how to use acceleration/friction, and might want to do that too. P.S. - can someone tell me if i should post this on stackoverflow or not? Thanks all! Edit: What i am looking for is not mario-like physics, but a simple equation that can be used to increase then decrease height over the time over a few seconds.

    Read the article

  • Linear Search in Python? [closed]

    - by POTUS
    def find_interval(mesh,x): '''This function finds the interval containing x according to the following rules, mesh is an ordered list with n numbers return 0 if x < mesh[0] return n if mesh[n-1] < x return k if mesh[k-1] <= x < mesh[k] return n-1 if mesh[n-2] <= x <= mesh[n-1] This function does a Linear search. 08/29/2012 ''' for n in range(len(mesh)): for k in range(len(mesh)): if x == mesh[n]: print "Found x at index:" return n elif x<mesh[n]: return 0 elif mesh[n-1]<x: return n elif mesh[n-2]<=x<=mesh[n-1]: return n-1 elif mesh[k-1]<=x<mesh[k]: return k mesh = [0, 0.1, 0.25, 0.5, 0.6, 0.75, 0.9, 1] print mesh print find_interval(mesh, -1) print find_interval(mesh, 0) print find_interval(mesh, 0.1) print find_interval(mesh, 0.8) print find_interval(mesh, 0.9) print find_interval(mesh, 1) print find_interval(mesh, 1.01) Output: [0, 0.100000000000000, 0.250000000000000, 0.500000000000000, 0.600000000000000, 0.750000000000000, 0.900000000000000, 1] 0 Found x at index: 0 2 6 -1 -1 0 I don't think the output is correct. Can anyone help me fix it? Thanks.

    Read the article

  • Python response parse [migrated]

    - by Pavel Shevelyov
    When I'm sending some data on host: r = urllib2.Request(url, data = data, headers = headers) page = urllib2.urlopen(r) print page.read() I have something like this: [{"command":"settings","settings":{"basePath":"\/","ajaxPageState":{"theme":"spsr","theme_token":"kRHUhchUVpxAMYL8Y8IoyYIcX0cPrUstziAi8gSmMYk","css":[]},"ajax":{"edit-submit":{"callback":"spsr_calculator_form_ajax","wrapper":"calculator_form","method":"replaceWith","event":"mousedown","keypress":true,"url":"\/ru\/system\/ajax","submit":{"_triggering_element_name":"submit"}}}},"merge":true},{"command":"insert","method":null,"selector":null,"data":"\u003cdiv id=\"calculator_form\"\u003e\u003cform action=\"\/ru\/service\/calculator\" method=\"post\" id=\"spsr-calculator-form\" accept-charset=\"UTF-8\"\u003e\u003cdiv\u003e\u003cinput id=\"edit-from-ship-region-id\" type=\"hidden\" name=\"from_ship_region_id\" value=\"\" \/\u003e\n\u003cinput type=\"hidden\" name=\"form_build_id\" value=\"form-0RK_WFli4b2kUDTxpoqsGPp14B_0yf6Fz9x7UK-T3w8\" \/\u003e\n\u003cinput type=\"hidden\" name=\"form_id\" value=\"spsr_calculator_form\" \/\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"bg_p\"\u003e \n\u0421\u0435\u0439\u0447\u0430\u0441 \u0412\u044b... bla bla bla but I want have something, like this: <html><h1>bla bla bla</h1></html> How can I do it?

    Read the article

  • SQLite with two python processes accessing it: one reading, one writing

    - by BBnyc
    I'm developing a small system with two components: one polls data from an internet resource and translates it into sql data to persist it locally; the second one reads that sql data from the local instance and serves it via json and a restful api. I was originally planning to persist the data with postgresql, but because the application will have a very low-volume of data to store and traffic to serve, I thought that was overkill. Is SQLite up to the job? I love the idea of the small footprint and no need to maintain yet another sql server for this one task, but am concerned about concurrency. It seems that with write ahead logging enabled, concurrently reading and writing a SQLite database can happen without locking either process out of the database. Can a single SQLite instance sustain two concurrent processes accessing it, if only one reads and the other writes? I started writing the code but was wondering if this is a misapplication of SQLite.

    Read the article

  • Multiple sites with the same codebase in Python

    - by Jimmy
    I am trying to run a large amount of sites which share about 90% of their code. They are simply designed to query an API and return the results. They will have a common userbase / database but will be configured slightly different and will have different CSS (perhaps even different templating). My initial idea was to run them as separate applications with a common library but I have read about the sites framework which would allow them to run from a single instance of Django which may help to reduce memory usage. https://docs.djangoproject.com/en/dev/ref/contrib/sites/ Is the site framework the right approach to a problem like this, and does it have real benefits over running separate applications? Initially I thought it was, but now I think otherwise. I have heard the following: Your SITE_ID is set in settings.py, so in order to have multiple sites, you need multiple settings.py configurations, which means multiple distinct processes/instances. You can of course share the code base between them, but each site will need a dedicated worker / WSGIDaemon to serve the site. This effectively removes any benefit of running multiple sites under one hood, if each site needs a UWSGI instance running. Alternative ideas of systems: https://github.com/iivvoo/django_layers https://github.com/shestera/django-multisite I don't know what route to be taking with this.

    Read the article

  • What does the python Codecs module do?

    - by Aerovistae
    I just read through the documentation on the Codecs module, but I guess my knowledge/experience of comp sci doesn't run deep enough yet for me to comprehend it. It's for dealing with encoding/decoding, especially Unicode, and while to many of you that's a complete and perfect explanation, to me that's really vague. I don't really understand what it means at all. Text is text is text in a .txt file? Or so this amateur thought. Can anyone explain?

    Read the article

  • Multithreading for a mixed-genre game in Python?

    - by arrogantc
    So here's the situation. I'm making a game that mixes two genres; arcade shooter and puzzler. They don't intertwine TOO much; all the interaction that really goes on is that every time an enemy is destroyed, a block is created. The blocks aren't even a part of the main collision detection system; they have their own more suited to their needs. What I want to ask is this; might it be a good idea to have the arcade shooter portion run on one thread, and the puzzle game portion run on another?

    Read the article

  • Using Python to traverse a parent-child data set

    - by user132748
    I have a dataset of two columns in a csv file. Th purpose of this dataset is to provide a linking between two different id's if they belong to the same person. e.g (2,3,5 belong to 1) e.g COLA COLB 1 2 ; 1 3 ; 1 5 ; 2 6 ; 3 7 ; 9 10 In the above example 1 is linked to 2,3,5 and 2 is the linked to 6 and 3 is linked to 7. What I am trying to achieve is to identify all records which are linked to 1 directly (2,3,5) or indirectly(6,7) and be able to say that these id's in column B belong to same person in column A and then either dedupe or add a new column to the output file which will have 1 populated for all rows that link to 1 e.g of expected output colA colB GroupField 1 2 1; 1 3 1; 1 5 1 ; 2 6 1 ;3 7 1; 9 10 9; 10 11 9 I am a newbie and so am not sure on how to approach this problem.Appreciate any inputs you'll can provide.

    Read the article

  • Are python's cryptographic modules good enough?

    - by Aerovistae
    I mean, say you were writing professional grade software that would involve sensitive client information. (Take this in the context of me being an amateur programmer.) Would you use hlib and hmac? Are they good enough to secure data? Or would you write something fancier by hand? Edit: In context of those libraries containing more or less the best hashing algorithms in the world, I guess it's silly to ask if you'd "write something fancier." What I'm really asking here is whether it's enough on its own.

    Read the article

  • Converting large files in python

    - by Cenoc
    I have a few files that are ~64GB in size that I think I would like to convert to hdf5 format. I was wondering what the best approach for doing so would be? Reading line-by-line seems to take more than 4 hours, so I was thinking of using multiprocessing in sequence, but was hoping for some direction on what would be the most efficient way without resorting to hadoop. Any help would be very much appreciated. (and thank you in advance) EDIT: Right now I'm just doing a for line in fd: approach. After that right now I just check to make sure I'm picking out the right sort of data, which is very short; I'm not writing anywhere, and it's taking around 4 hours to complete with that. I can't read blocks of data because the blocks in this weird file format I'm reading are not standard, it switches between three different sizes... and you can only tell which by reading the first few characters of the block.

    Read the article

  • How to control gnome-terminal from Python scrypt?

    - by user936401
    I am developing an application in PyGtk, and would like to launch a gnome-terminal and output commands to it. My user should then be able to modify the command, or maybe ignore using the up arrow ... etc. I have been able to launch a terminal, but can't work out how to send commands. This is how my application starts: class App(Gtk.Window): def __init__(self): Gtk.Window.__init__(self) process=subprocess.Popen(["gnome-terminal", "--class=App", "--name=app"], shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE) response,error=process.communicate()

    Read the article

  • python factory function best practices

    - by Jason S
    Suppose I have a file foo.py containing a class Foo: class Foo(object): def __init__(self, data): ... Now I want to add a function that creates a Foo object in a certain way from raw source data. Should I put it as a static method in Foo or as another separate function? class Foo(object): def __init__(self, data): ... # option 1: @staticmethod def fromSourceData(sourceData): return Foo(processData(sourceData)) # option 2: def makeFoo(sourceData): return Foo(processData(sourceData)) I don't know whether it's more important to be convenient for users: foo1 = foo.makeFoo(sourceData) or whether it's more important to maintain clear coupling between the method and the class: foo1 = foo.Foo.fromSourceData(sourceData)

    Read the article

  • How to play a fixed frequency sound using Python

    - by user98415
    I have tried a number of ways of playing a fixed frequency sound (e.g. 1000Hz) and nothing works. I have downloaded "beep" and that makes no noise. I tried interfacing to pyao, and that had no effect. I tried interfacing to audiere, and get a runtime error indicating the library could not be found, despite installing it from the software centre. Any guidance for installation of appropriate libraries and relevant code would be most appreciated. I cannot generate .mp3/ .wav files for this, but need to generate the tones at run time. Many thanks for you

    Read the article

  • Recursive function with for loop python

    - by user134743
    I have a question that should not be too hard but it has been bugging me for a long time. I am trying to write a function that searches in a directory that has different folders for all files that have the extension jpg and which size is bigger than 0. It then should print the sum of the size of the files that are in these categories. What I am doing right now is def myFuntion(myPath, fileSize): for myfile in glob.glob(myPath): if os.path.isdir(myFile): myFunction(myFile, fileSize) if (fnmatch.fnmatch(myFile, '*.jpg')): if (os.path.getsize(myFile) > 1): fileSize = fileSize + os.path.getsize(myFile) print "totalSize: " + str(fileSize) THis is not giving me the right result. It sums the sizes of the files of one directory but it does not keep suming the rest. For example if I have these paths C:/trial/trial1/trial11/pic.jpg C:/trial/trial1/trial11/pic1.jpg C:/trial/trial1/trial11/pic2.jpg and C:/trial/trial2/trial11/pic.jpg C:/trial/trial2/trial11/pic1.jpg C:/trial/trial2/trial11/pic2.jpg I will get the sum of the first three and the the size of the last 3 but I won´t get the size of the 6 together, if that makes sense. Thank you so much for your help!

    Read the article

  • Cross Compiling Boost for use on the Gumstix Overo with GumROS

    - by amelim
    I'm trying to cross-compile boost for use with the ROS framework on a Gumstix Overo. I've been following the posted instructions here (modifying the script when need be), however I've come across an issue where bjam will not compile boost properly. I call bjam as follows: # boost if [ ! -f /opt/gumros/lib/libboost_date_time-gcc41-mt-1_38.so ] ; then if [ ! -f boost_1_38_0.tar.gz ] ; then wget --tries=10 http://heanet.dl.sourceforge.net/sourceforge/boost/boost_1_38_0.tar.gz fi # tar xzf boost_1_38_0.tar.gz cd boost_1_38_0 GPP_PATH=${OVEROTOP}/tmp/cross/armv7a/arm-angstrom-linux-gnueabi/bin/g++ GPP_VER=`${GPP_PATH} -v 2>&1 | tail -1 | awk '{print $3}'` echo "using gcc : ${GPP_VER} : ${GPP_PATH} ; " > tools/build/v2/user-config.jam sudo apt-get install bjam set +o errexit sudo bjam --toolset=gcc-${GPP_VER} --prefix=/opt/gumros --with-date_time install set -o errexit cd .. else echo "boost appears to be already installed; skipping." fi if [ ! -f /opt/gumros/lib/libboost_date_time-gcc41-mt-1_38.so ] ; then echo "Failed to compile libboost_date_time"; exit; fi I've checked the user-config to make sure everything was kosher as well as making sure the GPP_PATH is correct. However, when I run the scrip I come across compilation errors such as: Reading package lists... Done Building dependency tree Reading state information... Done bjam is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded. ...patience... ...found 14370 targets... ...updating 14 targets... gcc.compile.c++ bin.v2/libs/date_time/build/gcc-4.3.3/release/threading-multi/gregorian/greg_month.o g++: error trying to exec 'cc1plus': execvp: No such file or directory "/home/andrew/overo-oe/tmp/cross/armv7a/arm-angstrom-linux-gnueabi/bin/g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pthread -fPIC -DBOOST_ALL_DYN_LINK=1 -DBOOST_ALL_NO_LIB=1 -DDATE_TIME_INLINE -DNDEBUG -I"." -c -o "bin.v2/libs/date_time/build/gcc-4.3.3/release/threading-multi/gregorian/greg_month.o" "libs/date_time/src/gregorian/greg_month.cpp" ...failed gcc.compile.c++ bin.v2/libs/date_time/build/gcc-4.3.3/release/threading-multi/gregorian/greg_month.o... gcc.compile.c++ bin.v2/libs/date_time/build/gcc-4.3.3/release/threading-multi/gregorian/greg_weekday.o g++: error trying to exec 'cc1plus': execvp: No such file or directory "/home/andrew/overo-oe/tmp/cross/armv7a/arm-angstrom-linux-gnueabi/bin/g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pthread -fPIC -DBOOST_ALL_DYN_LINK=1 -DBOOST_ALL_NO_LIB=1 -DDATE_TIME_INLINE -DNDEBUG -I"." -c -o "bin.v2/libs/date_time/build/gcc-4.3.3/release/threading-multi/gregorian/greg_weekday.o" "libs/date_time/src/gregorian/greg_weekday.cpp" ...failed gcc.compile.c++ bin.v2/libs/date_time/build/gcc-4.3.3/release/threading-multi/gregorian/greg_weekday.o... gcc.compile.c++ bin.v2/libs/date_time/build/gcc-4.3.3/release/threading-multi/gregorian/date_generators.o g++: error trying to exec 'cc1plus': execvp: No such file or directory Etc... For reference, I'm using this tutorial to help me out. http://www.ros.org/wiki/gumros

    Read the article

< Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >