Search Results

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

Page 80/608 | < Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >

  • Python: Retrieve Image from MSSQL

    - by KoRkOnY
    Dear All, I'm working on a Python project that retrieves an image from MSSQL. My code is able to retrieve the images successfully but with a fixed size of 63KB. if the image is greater than that size, it just brings the first 63KB from the image! The following is my code: #!/usr/bin/python import _mssql mssql=_mssql.connect('<ServerIP>','<UserID>','<Password>') mssql.select_db('<Database>') x=1 while x==1: query="select TOP 1 * from table;" if mssql.query(query): rows=mssql.fetch_array() rowNumbers = rows[0][1] #print "Number of rows fetched: " + str(rowNumbers) for row in rows: for i in range(rowNumbers): FILE=open('/home/images/' + str(row[2][i][1]) + '-' + str(row[2][i][2]).strip() + ' (' + str(row[2][i][0]) + ').jpg','wb') FILE.write(row[2][i][4]) FILE.close() print 'Successfully downloaded image: ' + str(row[2][i][0]) + '\t' + str(row[2][i][2]).strip() + '\t' + str(row[2][i][1]) else: print mssql.errmsg() print mssql.stdmsg() mssql.close()

    Read the article

  • Calling Python from Java through scripting engine (jython)?

    - by griffin
    I'm trying to call Jython from a Java 6 application using javax.script: import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException; public class jythonEx { public static void main (String args[]) throws ScriptException { ScriptEngineManager mgr = new ScriptEngineManager(); ScriptEngine pyEngine = mgr.getEngineByName("python"); try { pyEngine.eval("print \"Python - Hello, world!\""); } catch (Exception ex) { ex.printStackTrace(); } } } This is causing a NullPointerException: java.lang.NullPointerException at jythonEx.main(jythonEx.java:12) Does anyone have any idea what I'm doing wrong here? Edit: Thanks for the responses! I added jython.jar to the classpath and it runs properly: java -cp "./;jython.jar" jythonEx

    Read the article

  • Mac OS X pygame input goes to Terminal instead of Python

    - by Parappa
    I'm having trouble running a pygame based app on Mac OS X via Terminal. Input events such as keystrokes go to the Terminal instead of my Python app, and are detected by pygame. For example, I have the following test script: import pygame pygame.init() screen = pygame.display.set_mode((640, 480)) done = False while not done: pygame.event.pump() keys = pygame.key.get_pressed() if keys[pygame.K_ESCAPE]: done = True if keys[pygame.K_SPACE]: print "got here" Neither K_ESCAPE nor K_SPACE will be handled by this script when I run it from a Mac OS X Terminal, but Terminal will echo back the spaces. I'm running the MacPorts port of pygame (py-game), which depends on Python 2.4, and I've also used python_select to make python24 the active version.

    Read the article

  • GAE datastore eager loading in python api

    - by tomus
    I have two models in relation one-to-many: class Question(db.Model): questionText = db.StringProperty(multiline=False) class Answer(db.Model): answerText = db.StringProperty(multiline=False) question = db.ReferenceProperty(Question, collection_name='answers') I have front-end implemented in Flex and use pyamf to load data. When i try to load all answers with related questions all works as desired and I can access field answer.question however in case of loading questions (e.g. by Questions.all() ), 'question.answers' remains empty/null (though on server/python side I can revise question.answers without problem - probably after lazy-loading). So is it possible to load all questions along with answers ? (I know this is possible in JPA Java api but what about python ?) Shoud I use additional setting, GQL query or django framework to make it work ?

    Read the article

  • python,running command line servers - they're not listening properly

    - by deepblue
    hello all Im attempting to start a server app (in erlang, opens ports and listens for http requests) via the command line using pexpect (or even directly using subprocess.Popen()). the app starts fine, logs (via pexpect) to the screen fine, I can interact with it as well via command line... the issue is that the servers wont listen for incoming requests. The app listens when I start it up manually, by typing commands in the command line. using subprocess/pexpect stops the app from listening somehow... when I start it manually "netstat -tlp" displays the app as listening, when I start it via python (subprocess/pexpect) netstat does not register the app... I have a feeling it has something to do with the environemnt, the way python forks things, etc. Any ideas? thank you

    Read the article

  • Python os.path.join on Windows

    - by Jim
    I am trying to learn python and am making a program that will output a script. I want to use os.path.join, but am pretty confused. According to the docs if I say: os.path.join('c:', 'sourcedir') I get "C:sourcedir". According to the docs, this is normal, right? But when I use the copytree command, Python will output it the desired way, for example: import shutil src = os.path.join('c:', 'src') dst = os.path.join('c':', 'dst') shutil.copytree(src, dst) Here is the error code I get: WindowsError: [Error 3] The system cannot find the path specified: 'C:src/*.*' If I wrap the os.path.join with os.path.normpath I get the same error. If this os.path.join can't be used this way, then I am confused as to its purpose. According to the pages suggested by Stack Overflow, slashes should not be used in join—that is correct, I assume?

    Read the article

  • How to implement mib module in net-snmp with python?

    - by Tom Carly
    Hi, in the faq, i read this "..the agent can also support MIB modules implemented in perl or (from 5.4) python." I have built net-snmp with python support, but it's not clear yet how to actually implement my own MIB module with python now. The python scripts i see in the python directory are related to implementing an snmp client, not an snmp agent. Probably i just miss the point somewhere. Can someone give me a hint on how to get started with this? Thanks, Tom

    Read the article

  • How to print non-ASCII characters in Python

    - by Roman
    I have a problem when I'm printing (or writing to a file) the non-ASCII characters in Python. I've resolved it by overriding the str method in my own objects, and making "x.encode('utf-8')" inside it, where x is a property inside the object. But, if I receive a third-party object, and I make "str(object)", and this object has a non-ASCII character inside, it will fail. So the question is: is there any way to tell the str method that the object has an UTF-8 codification, generically? I'm working with Python 2.5.4.

    Read the article

  • Using a debugger and curses at the same time?

    - by Matt Joiner
    I'm calling python -m pdb myapp.py, when an exception fires, and I'd normally be thrown back to the pdb interpreter to investigate the problem. However this exception is being thrown after I've called through curses.wrapper() and entered curses mode, rendering the pdb interpreter useless. How can I work around this?

    Read the article

  • Installing a Python program on Linux

    - by Honza Pokorny
    I wrote a Python program. I would like to add to it an installation script that will set up everything necessary - like desktop icon, entry in the menu, home directory file, etc. I'm working on Linux (ubuntu). When a Python program is installed, what needs to happen in general? I know that it probably depends on the nature of the program. Can you give me some general ideas? Or, point me in the right direction? I have no idea how to look for this on Google. Thanks

    Read the article

  • Cannot easy_install readline for Python 2.7.3 on Mac Os Lion

    - by user11170
    I am trying to install readline for python 2.7.3 installed via homebrew. If I type easy_install readline I get Downloading http://pypi.python.org/packages/source/r/readline/readline-6.2.2.tar.gz#md5=ad9d4a5a3af37d31daf36ea917b08c77 Processing readline-6.2.2.tar.gz Writing /var/folders/44/dhrdb5sx53s243j4w03063vh0000gn/T/easy_install-64FbG8/readline-6.2.2/setup.cfg Running readline-6.2.2/setup.py -q bdist_egg --dist-dir /var/folders/44/dhrdb5sx53s243j4w03063vh0000gn/T/easy_install-64FbG8/readline-6.2.2/egg-dist-tmp-NOmStB clang: error: no such file or directory: 'readline/libreadline.a' clang: error: no such file or directory: 'readline/libhistory.a' error: Setup script exited with error: command '/usr/bin/clang' failed with exit status 1 Any ideas about how I could fix this ? Thanks

    Read the article

  • Python: Indexing list for element in nested list

    - by aquateenfan
    I know what I'm looking for. I want python to tell me which list it's in. Here's some pseudocode: item = "a" nested_list = [["a", "b"], ["c", "d"]] list.index(item) #obviously this doesn't work here I would want python to return 0 (because "a" is an element in the first sub-list in the bigger list). I don't care which sub-element it is. I don't care if there are duplicates, e.g., ["a", "b", "a"] should return the same thing as the above example. Sorry if this is a dumb question. I'm new to programming.

    Read the article

  • writing a fast parser in python

    - by panzi
    I've written a hands-on recursive pure python parser for a some file format (ARFF) we use in one lecture. Now running my exercise submission is awfully slow. Turns out by far the most time is spent in my parser. It's consuming a lot of CPU time, the HD is not the bottleneck. I wonder what performant ways are there to write a parser in python? I'd rather not rewrite it in C. I tried to use jython, but that decreased performance a lot! The files I parse are partially huge ( 150 MB) with very long lines. My current parser only needs a look-ahead of one character. I'd post the source here but I don't know if that's such a good idea. After all the submission deadline has not jet ended. But then, the focus in this exercise is not the parser. You can choose whatever language you want to use and there already is a parser for Java.

    Read the article

  • python foursquare - SSL3 certificate verify failed

    - by user1814277
    I'm trying to make a userless request to the Foursquare API using Mike Lewis' Python wrapper - https://github.com/mLewisLogic/foursquare: client = foursquare.Foursquare(client_id=Client_ID, client_secret=Client_Secret) categs = client.venues.categories() Intermittently, I get a "Error connecting to Foursquare API" msg. Running a logger to catch a more detailed message produces: "SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed" This didn't use to happen and occurs both on my local Windows development machine and on a server running ubuntu. Am I missing something basic here about security certificates? The problem is intermittent and sometimes just leaving it a minute and retrying fixes the problem temporarily. I've downloaded the latest 20120716 version of the wrapper although in the code for init.py it still says API_VERSION = '20120608'. I'm using Python 2.73 and have also signed up for the Foursquare API key, using the id and secret in the above code. I listed the urls, using my local IP:8000 and tried using separate keys for the local and dev machines but this seems to make no difference. Help much appreciated. Thanks.

    Read the article

  • How do quickly search through a .csv file in Python

    - by Baldur
    I'm reading a 6 million entry .csv file with Python, and I want to be able to search through this file for a particular entry. Are there any tricks to search the entire file? Should you read the whole thing into a dictionary or should you perform a search every time? I tried loading it into a dictionary but that took ages so I'm currently searching through the whole file every time which seems wasteful. Could I possibly utilize that the list is alphabetically ordered? (e.g. if the search word starts with "b" I only search from the line that includes the first word beginning with "b" to the line that includes the last word beginning with "b") I'm using import csv. (a side question: it is possible to make csv go to a specific line in the file? I want to make the program start at a random line) Edit: I already have a copy of the list as an .sql file as well, how could I implement that into Python?

    Read the article

  • Detecting Infinite recursion in Python or dynamic languages

    - by drozzy
    Recently I tried compiling program something like this with GCC: int f(int i){ if(i<0){ return 0;} return f(i-1); and it ran just fine. When I inspected the stack frames the compiler optimized the program to use only one frame, by just jumping back to the beginning of the function and only replacing the arguments to f. And - the compiler wasn't even running in optimized mode. Now, when I try the same thing in Python - I hit maximum recursion wall (or stack overflow). Is there way that a dynamic language like python can take advantage of these nice optimizations? Maybe it's possible to use a compiler instead of an interpreter to make this work? Just curious!

    Read the article

  • Link errors loading a Python extension for i386 MacOS that was compiled on a PPC

    - by deekoo
    I'm trying to compile a Python extension (written in C) on a PPC mac (running OS X 10.4, XCode 2.5), to run under Ren'Py on both PPC and i386 MacOS. The PPC version works; the i386 version fails to load with ImportError: dlopen(./fasttint_macos_i386.dylib, 2): Symbol not found: _PyType_GenericNew Referenced from: /Applications/Games/Demos/CuteKnightKingdom-demo-0.9.25.1-mac/CuteKnightKingdom-demo.app/Contents/Resources/autorun/game/fasttint_macos_i386.dylib Expected in: /Applications/Games/Demos/CuteKnightKingdom-demo-0.9.25.1-mac/CuteKnightKingdomdemo.app/Contents/Resources/autorun/game/fasttint_macos_i386.dylib As best I can tell, _PyType_GenericNew should be defined by Ren'Py's python - why is it trying to find an internal declaration for the symbol instead of the external one?

    Read the article

  • Clear command line output from Python [Eclipse]

    - by Tomas Lycken
    I'm using Eclipse for writing Python, and I want to be able to easily clear the screen. I've seen this question, and tried (among other things suggested there) the following solution import os def clear(): os.system('cls' if os.name == 'nt' else 'clear') but it doesn't entirely solve my problem. Instead of clearing the screen, the routine prints a small square (as if wanting to print an unknown character) to the command output window in Eclipse. Typing cls in the command line works perfectly fine, as does running a Python script with the above code from command line. But how can I make it look nice in Eclipse as well?

    Read the article

< Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >