Search Results

Search found 13693 results on 548 pages for 'python metaprogramming'.

Page 12/548 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Importing modules on portable python

    - by PPTim
    Hi, I am running PortablePython_1.1_py2.6.1 on a USB stick. My code relies on some modules that are not preinstalled. Does anyone know whether it is possible to add new modules to a portable python installation? Simply copying in folders into site-lib does not seem to work.

    Read the article

  • Getting traceback from Python C API

    - by TheObserver
    I have a Python C API extension module which occassionally falls over with an uninformative "MemoryError". It's clearly not an error that's catered for by the module's exception handlers. How do I get a more informative error traceback so I can figure out what's gone wrong in the extension module?

    Read the article

  • Generate a random letter in Python

    - by Waterfox
    Is there a way to generate random letters in Python (like random.randint but for letters)? The range functionality of random.randint would be nice but having a generator that just outputs a random letter would be better than nothing.

    Read the article

  • Get client ip with python

    - by Elad
    Hi, I'm a newbie in python. I want to write a simple web that prints the client ip on screen my http.conf Handler: AddHandler mod_python .py PythonHandler mod_python.publisher PythonDebug On The cgi.escape(os.environ["REMOTE_ADDR"]) return this error: KeyError: 'REMOTE_ADDR' and I just get lost with the BaseHTTPRequestHandler so what is the simple way to get the client ip? thank you.

    Read the article

  • Python-Requests close http connection

    - by James Eggers
    I was wondering, how do you close a connection with Requests (python-requests.org)? With httplib it's HTTPConnection.close(), but how do I do the same with Requests? Code is below: r = requests.post("https://stream.twitter.com/1/statuses/filter.json", data={'track':toTrack}, auth=('username', 'passwd')) for line in r.iter_lines(): if line: self.mongo['db'].tweets.insert(json.loads(line)) Thanks in advance.

    Read the article

  • Screen overlay with Python, paint over an active window with background python script

    - by tvlife.admin
    Hi I'm writing a python script that runs in the background and takes screenshots of another application that is active. Then it analyses the screenshots and now it should overlay a certain image over the active app or the screen. I still need to be able to make mouse and keyboard inputs in the active app. So I need a way to overlay/paint on another window or on the screen, and still keep the other window the active window so that I can make inputs. I would prefer to do that with python in Mac OS, but if it isn't possible, other languages and even Windows (if really necessary) would also be ok. Can anybody help me? Thanks in advance!

    Read the article

  • getting a pyserial not loaded error

    - by skinnyTOD
    I'm getting a "pyserial not loaded" error with the python script fragment below (running OSX 10.7.4). I'm trying to run a python app called Myro for controlling the Parallax Scribbler2 robot - figured it would be a fun way to learn a bit of Python - but I'm not getting out of the gate here. I've searched out all the Myro help docs but like a lot in-progress open source programs, they are a moving target and conflicting, out of date, or not very specific about OSX. I have MacPorts installed and installed py27-serial without error. MacPorts lists the python versions I have installed, along with the active version: Available versions for python: none python24 python25 python25-apple python26 python26-apple python27 python27-apple (active) python32 Perhaps stuff is getting installed in the wrong places or my PATH is wrong (I don't much know what I am doing in Terminal and have probably screwed something up). Trying to find out about my sys.path - here's what I get: import sys sys.path ['', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages'] Is that a mess? Can I fix it? Anyway, thanks for reading this far. Here's the python bit that is throwing the error. The error occurs on 'try import serial'. # Global variable robot, to set SerialPort() robot = None pythonVer = "?" rbString = None ptString = None statusText = None # Now, let's import things import urllib import tempfile import os, sys, time try: import serial except: print("WARNING: pyserial not loaded: can't upgrade!") sys.exit() try: input = raw_input # Python 2.x except: pass # Python 3 and better, input is defined try: from tkinter import * pythonver = "3" except: try: from Tkinter import * pythonver = "2" except: pythonver = "?"

    Read the article

  • What is the best way to parse python script file in C/C++ code

    - by alexpov
    I am embedding python in C/C++ program. What I am trying to do is to parse the python script file from the C/C++ program, break the file to "blocks" so that each "block" is an a valid command in python code. Each block I need to put into std::string. For example: #PythonScript.py import math print "Hello Python" i = 0; while (i < 10): print "i = " , i; i = i + 1; print "GoodBye Python" In this script are 5 different "blocks": the first one is "import math;" the second is "print "Hello Python;" the third is "i = 0;" and the fourth is while (i < 10):\n\tprint "i = " , i;\n\ti = i + 1; My knowledge in python is very basic and I am not familiar with the python code syntax. What is the best way to do this, is there any Python C/C++ API function that supports this? why i need it - for GUI purpose. My program , which is writen in C, uses python to make some calculations. I run from C code , using python C API , python script and what i need is a way to capture python's output in my program. I catch it and evrything is ok, the problem is when the script involves user input. What happens is that i capture python's output after the script is finished , therefore, when there is an input command in the script i get a black screen .... i need to get all the printings before the input command. The first solution i tried is to parss the script to valid commands and run each comand, one after the other , seperatly .... for this i need to pars the script and deside what is a command and what is not ... The question is : what is the best way to do this and if there is somthing that allready does ?

    Read the article

  • Python requests SSL version

    - by Aaron Schif
    I am using the python requests module on Ubuntu 13.04. I keep getting the error: requests.exceptions.SSLError: [Errno 1] _ssl.c:504: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure When I use curl, it fails by default but succeeds with the -3 option. curl https://username:Password@helloworldurl -3 This leads me to believe that it is the SSL version, which I found may be badly supported on ubuntu while searching the error. Sooo. How do I change or check the SSL version using python preferably with requests. Note: the url is private and cannot be given out. Sorry.

    Read the article

  • python, cluster computing, design help [closed]

    - by j dawg
    I would like to create my own parallel computing server. Can you please point me to some resources I can use to help me develop my server. Sorry, like I said I need help getting started. Yes, I am limited to python, I cannot use C. I am using a bunch of workstations and I want to use all the cpus in those machines. So what I am looking for is blog posts, books, articles that can help me develop my own client/server tools to send code from the client to the servers and spawn python processes based on the number of cpus. I know how to do the subprocessing/multiprocessing part of the program, I do not know how to create the server that will take the client's requests. I also need to figure out what is the best way to handle sending file data, like netcdf files or other spatial data. Any suggestions very welcome.

    Read the article

  • Python's Django or Delphi's IntraWeb?

    - by Azad Salahli
    Well, forgive me if it is an off-topic question. I have no knowledge about web programming, so I apologize in advance, if it is a stupid question. I will start to build a web based application. To be more specific, I will make a webpage which will have components like buttons, textboxes and etc. It will use a database to store information. My question is, which one is better to learn for that purpose? Python's Django or Delphi's IntraWeb? I know both Delphi and Python(although I know Delphi better).

    Read the article

  • Python scripts link to GUI using an IDE

    - by YomalSamindu
    I am studying python. Now I can write python scripts(codes) to some extent. I am interested in making GUI to those written programs.I like to do it using an IDE rather than using PyGTK or Tkinter. Can anyone help me how to start with this and link my scripts to a GUI. I downloaded a IDE called "glade". But I don't know how to use this IDE. I need some tutorial guide also. Can anyone help me.Please.Thank you!

    Read the article

  • Collision library for bullet hell in Python

    - by darkfeline
    I am making a bullet hell game in Python and am looking for a suitable collision library, taking the following into consideration: The library should do 2D polygon collision. It should be very fast. As a bullet hell game, I expect to do collision checks between hundreds, likely thousands of objects every frame at a consistent 60fps. Good documentation Permissive license (like MIT, not GPL) I am also considering writing my own library in C/C++ and wrapping with python ctypes in the event that no such library exists, though I do not have experience with collision detection algorithms, so I am not sure if this would be more trouble than it's worth. Could someone provide some guidance on this matter?

    Read the article

  • Temporarily share/deploy a python (flask) application

    - by Jeff
    Goal Temporarily (1 month?) deploy/share a python (flask) web app without expensive/complex hosting. More info I've developed a basic mobile web app for the non-profit I work for. It's written in python and uses flask as its framework. I'd like to share this with other employees and beta testers (<25 people). Ideally, I could get some sort of simple hosting space/service and push regular updates to it while we test and iterate on this app. Think something along the lines of dropbox, which of course would not work for this purpose. We do have a website, and hosting services for it, but I'm concerned about using this resource as our website is mission critical and this app is very much pre-alpha at this point. Options I've researched / considered Self host from local machine/network (slow, unreliable) Purchase hosting space (with limited non-profit resources, I'm concerned this is overkill) Using our current web server / hosting (not appropriate for testing) Thanks very much for your time!

    Read the article

  • Using the AccountsService API with Python

    - by pabluk
    I'm writing an application for the Ubuntu app showdown and I try to read/write the user's profile picture using this >>> from gi.repository import AccountsService, GLib >>> current_user = GLib.get_user_name() >>> user = AccountsService.UserManager.get_default().get_user(current_user) >>> print user.get_icon_file() None >>> print user.get_user_name() None But apparently does not work. Is there another way to use AccountsService with Python? I could not find more documentation about AccountsService and Python.

    Read the article

  • Concrete examples of Python's "only one way to do it" maxim

    - by Charles Roper
    I am learning Python and am intrigued by the following point in PEP 20 The Zen of Python: There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Could anyone offer any concrete examples of this maxim? I am particularly interested in the contrast to other languages such as Ruby. Part of the Ruby design philosophy (originating with Perl, I think?) is that multiple ways of doing it is A Good Thing. Can anyone offer some examples showing the pros and cons of each approach. Note, I'm not after an answer to which is better (which is probably too subjective to ever be answered), but rather an unbiased comparison of the two styles.

    Read the article

  • Python script liking to GUI using IDE

    - by YomalSamindu
    I am studying python. Now I can write python scripts (codes) to some extent. I used IDLE for this. I am interested in making GUI to those written programs. I like to do it using an IDE rather than using PyGTK or Tkinter. Can anyone help me how to start with this and link my scripts to a GUI? I downloaded a IDE called glade, but I don't know how to use this IDE. I need some tutorial guide also. Can anyone help me, please? Thank you!

    Read the article

  • Can python and php work together?

    - by user71741
    I am having a mobile app created for ios. The developers built the app in php. The app requires an algorithm so I found another programmer to develop it. The algorithm programmer built the algorithm in python. The developers refuse to finish the app because they say it won't work with python, while the programmer insist it will. The programmer says put the algorithm in its on server and connect then over http. Will this work and I'd so how risky is it to future problems?

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >