Search Results

Search found 14486 results on 580 pages for 'python idle'.

Page 70/580 | < Previous Page | 66 67 68 69 70 71 72 73 74 75 76 77  | Next Page >

  • Integrate Python Projects Into Xcode

    - by Vynile
    Hi! I'm a Mac user, and one of my hobbies is programming. I use Xcode, the integrated IDE of Mac OS X. I started to learn Python programming langage, and I want to use Xcode for developing my scripts. I searched for weeks in the internet, but I didn't find something interesting. Firstly, I want to update the integrated interpreter of Mac OS X, that is on 2.6 version. And secondly, I want to create a Python project on Xcode easily, like I do with C & C++ projects. Can you help me? I really need help! Cordially.

    Read the article

  • Python, implementing proxy support for a socket based application (not urllib2)

    - by Terry Felkrow
    Hey guys, I am little stumped: I have a simple messenger client program (pure python, sockets), and I wanted to add proxy support (http/s, socks), however I am a little confused on how to go about it. I am assuming that the connection on the socket level will be done to the proxy server, at which point the headers should contain a CONNECT + destination IP (of the chat server) and authentication, (if proxy requires so), however the rest is a little beyond me. How is the subsequent connection handled, specifically the reading/writing, etc... Are there any guides on proxy support implementation for socket based (tcp) programming in Python? Thank you

    Read the article

  • [SOLVED]Port C's fread(&struct,....) to Python

    - by user287669
    Hey, I'm really struggling with this one. I'am trying to port a small piece of someone else's code to Python and this is what I have: typedef struct { uint8_t Y[LUMA_HEIGHT][LUMA_WIDTH]; uint8_t Cb[CHROMA_HEIGHT][CHROMA_WIDTH]; uint8_t Cr[CHROMA_HEIGHT][CHROMA_WIDTH]; } __attribute__((__packed__)) frame_t; frame_t frame; while (! feof(stdin)) { fread(&frame, 1, sizeof(frame), stdin); // DO SOME STUFF } Later I need to access the data like so: frame.Y[x][y] So I made a Class 'frame' in Python and inserted the corresponding variables(frame.Y, frame.Cb, frame.Cr). I have tried to sequentially map the data from Y[0][0] to Cr[MAX][MAX], even printed out the C struct in action but didn't manage to wrap my head around the method used to put the data in there. I've been struggling overnight with this and have to get back to the army tonight, so any immediate help is very welcome and appreciated. Thanks

    Read the article

  • python: calling constructor from dictionary?

    - by Jason S
    I'm not quite sure of the terminology here so please bear with me.... Let's say I have a constructor call like this: machineSpecificEnvironment = Environment( TI_C28_ROOT = 'C:/appl/ti/ccs/4.1.1/ccsv4/tools/compiler/c2000', JSDB = 'c:/bin/jsdb/jsdb.exe', PYTHON_PATH = 'c:/appl/python/2.6.4', ) except I would like to replace that by an operation on a dictionary provided to me: keys = {'TI_C28_ROOT': 'C:/appl/ti/ccs/4.1.1/ccsv4/tools/compiler/c2000', 'JSDB': 'c:/bin/jsdb/jsdb.exe', 'PYTHON_PATH': 'c:/appl/python/2.6.4'} machineSpecificEnvironment = Environment( ... what do I put here? it needs to be a function of "keys" ... ) How can I do this?

    Read the article

  • Python IPC, popen too slow

    - by UnableToLoad
    i need to run a subprocess (./myProgram) form python script and get output, actually i do this: import subprocess proc = subprocess.Popen('./generate_out', shell=False, stdout=subprocess.PIPE, ) while proc.poll() is None: out = proc.stdout.readline() data = doStuff(out) print(data) but is slow, sometimes pass a lot of time between the output produced by ./generate_out and the print(data), knowing that my doStuff() function is very fast, i think there is some buffer slowing down my pipe... Notes: ./generate_out, generates potentially an unlimited number of lines of finite length each. It seems that when too few chars are put in the pipe between the two processes nothing happens, then when enough is produced i get a huge print (non the expected behaviour!) sometimes i wait many seconds (10-20 and more) between generate_out print and python print) what can i do? maybe communicate() is faster? anithing else? Thank you a lot!

    Read the article

  • Doxygen C++ comment string parser in python?

    - by Sebastian
    Does anybody know of a python module to parse a doxygen style C++ comment string? I mean a string like this (simple example): /** * A constructor. * A more elaborate description of the constructor. * @param param1 test1 * @param param2 test2 */ and I would like to extract the brief, the long description, the parameters, the return value etc. I'm currently doing this using string methods and regular expressions but my solution is not very robust. Alternatively can anybody recommend an easy to use python parser lib that I can set up quickly? Thanks in advance

    Read the article

  • Alternative to nesting for loops in Python

    - by davenz
    I've read that one of the key beliefs of Python is that flat nested. However, if I have several variables counting up, what is the alternative to multiple for loops? My code is for counting grid sums and goes as follows: def horizontal(): for x in range(20): for y in range(17): temp = grid[x][y: y + 4] sum = 1 for n in temp: sum += int(n) return sum This seems to me like it is too heavily nested. Firstly, what is considered to many nested loops in Python ( I have certainly seen 2 nested loops before). Secondly, if this is too heavily nested, what is an alternative way to write this code?

    Read the article

  • how to load a module within python debugger

    - by MK
    This looks like something simple but I could not find the answer so far - I have just learnt python and need to start learning pdb. In my module I have the usual if __name__ == __main_ trick to execute some code when the module is run as a program. So far I have been running it via python -m mymod arg1 arg2 syntax Now I want to do exactly the same thing from inside pdb. Normally in C, I would just do gdb mybinary followed by run arg1 arg2 But I cannot figure out how to achieve the same thing in pdb. I am sure there has to be a simple way to achieve this but it is taking me too long to search for it.. Thanks for your help!

    Read the article

  • Embedding Python in C: Having problems importin local modules

    - by Drew
    I'm needing to run Python scripts within a C-based app. I am able to import standard modules from the Python libraries i.e.: PyRun_SimpleString("import sys") But when I try to import a local module 'can' PyRun_SimpleString("import can") returns the error msg: Traceback (most recent call last): File "", line 1, in ImportError: No module named can When I type the command "import can" in iPython, the system is able to find it. How can I link my app with can? I've tried setting PYTHONPATH to my working directory. Thanks.

    Read the article

  • Python in AWS Elastic Beasntalk: Private package dependencies

    - by Adam Matan
    I would like to deploy a Python Flask application on beanstalk. The application depends on external packages (e.g. geopy) and internal packages (e.g. adam_geography). The manual Create a requirements.txt file and place it in the top-level directory of your source bundle. This would probably fetch geopy and its dependencies, but would not fetch adam_geography which is available from a custom repo inside my VPC. How do I specify/upload private, internal Python package dependencies in a Beanstalk application?

    Read the article

  • Installing mySQL on mac for use with python

    - by Paul Patterson
    I am aware that there are umpteen similar questions here, and on other forums, but none of them have been able to help me. I simply want to install mySQL on my mac (running snow leopard 10.6.5) for use with Python. So far I have: 1) downloaded and installed [mysql-5.5.8-osx10.6-x86_64.dmg] (I have also accidentally downloaded and installed [mysql-5.1.54-osx10.6-x86_64.dmg]) 2) downloaded and installed [mySQL-python-1.2.3] 3) added the following to my .bash_profile: [export PATH=$PATH:/usr/local/mysql/bin] but when i run:import mySQLdb in terminal I am met with the following message: Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named mySQLdb Can anyone help?

    Read the article

  • Newbie question about file formatting in Python

    - by user568041
    I'm writing a simple program in Python 2.7 using pycURL library to submit file contents to pastebin. Here's the code of the program: #!/usr/bin/env python2 import pycurl, os def send(file): print "Sending file to pastebin...." curl = pycurl.Curl() curl.setopt(pycurl.URL, "http://pastebin.com/api_public.php") curl.setopt(pycurl.POST, True) curl.setopt(pycurl.POSTFIELDS, "paste_code=%s" % file) curl.setopt(pycurl.NOPROGRESS, True) curl.perform() def main(): content = raw_input("Provide the FULL path to the file: ") open = file(content, 'r') send(open.readlines()) return 0 main() The output pastebin looks like standard Python list: ['string\n', 'line of text\n', ...] etc. Is there any way I could format it so it looks better and it's actually human-readable? Also, I would be very happy if someone could tell me how to use multiple data inputs in POSTFIELDS. Pastebin API uses paste_code as its main data input, but it can use optional things like paste_name that sets the name of the upload or paste_private that sets it private.

    Read the article

  • Is there are standard way to store a database schema outside a python app

    - by acrosman
    I am working on a small database application in Python (currently targeting 2.5 and 2.6) using sqlite3. It would be helpful to be able to provide a series of functions that could setup the database and validate that it matches the current schema. Before I reinvent the wheel, I thought I'd look around for libraries that would provide something similar. I'd love to have something akin to RoR's migrations. xml2ddl doesn't appear to be meant as a library (although it could be used that way), and more importantly doesn't support sqlite3. I'm also worried about the need to move to Python 3 one day given the lack of recent attention to xml2ddl. Are there other tools around that people are using to handle this?

    Read the article

  • Python - network buffer handling question...

    - by Patrick Moriarty
    Hi, I want to design a game server in python. The game will mostly just be passing small packets filled with ints, strings, and bytes stuffed into one message. As I'm using a different language to write the game, a normal packet would be sent like so: Writebyte(buffer, 5); // Delimit type of message Writestring(buffer, "Hello"); Sendmessage(buffer, socket); As you can see, it writes the bytes to the buffer, and sends the buffer. Is there any way to read something like this in python? I am aware of the struct module, and I've used it to pack things, but I've never used it to actually read something with mixed types stuck into one message. Thanks for the help.

    Read the article

  • How can i add encoding to the python generated CSV file

    - by user1958218
    I am following this post http://stackoverflow.com/a/9016545 and i want to know that how can i do that in Python. I don't know how can i insert BOM data in there This is my current code response = HttpResponse(content_type='text/csv') response['Content-Type'] = 'application/octet-stream' response['Content-Disposition'] = 'attachment; filename="results.csv"' writer = UnicodeWriter(response, quoting=csv.QUOTE_ALL, encoding="utf-8") I want to convert to utf -16 . BOm data is this but don't know how to insert it From here http://stackoverflow.com/a/4440143 echo "\xEF\xBB\xBF"; // UTF-8 BOM But i want it for python and utf-16 I tried opening that csv in notepad and insert \xef\xbb\xb in beginning and excel displayed that correctly. But it is also visible before first column. How can i hide that because user wont like that

    Read the article

  • Implementation Details as a "Document" ( In generic terms) - Python, C++

    - by mgj
    Hi..:) For documentation and presentation purposes, we often find professionals/students creating SRS, coding guidelines etc. for these things there is some kind of a checklist which one could use to appropriately match what could relate to a specific case and accordingly one does a documentation for each. On those grounds could you please give me some sort of a checklist( any points/guidelines) one could use for going about Implementation( in the form of Implementation Details) in Python and C++ . Although this might sound specific as the query is "Implementation Details" and is different for different cases as one goes about the REAL implementation, I just want a SET of guidelines one should follow ( Preferably In Python, C++ specific, even for any other language is Welcome) if this( Implementation Details ) has to also be documented or presented. Hope the question is clear, I am sorry if it still sounds ambiguous, I guess this is the best I could do to frame my query. Thank you for your time...:)

    Read the article

  • Python elegant inverse function of int(string,base)

    - by random guy
    python allows conversions from string to integer using any base in the range [2,36] using: int(string,base) im looking for an elegant inverse function that takes an integer and a base and returns a string for example >>> str_base(224,15) 'ee' i have the following solution: def digit_to_char(digit): if digit < 10: return chr(ord('0') + digit) else: return chr(ord('a') + digit - 10) def str_base(number,base): if number < 0: return '-' + str_base(-number,base) else: (d,m) = divmod(number,base) if d: return str_base(d,base) + digit_to_char(m) else: return digit_to_char(m) note: digit_to_char() works for bases <= 169 arbitrarily using ascii characters after 'z' as digits for bases above 36 is there a python builtin, library function, or a more elegant inverse function of int(string,base) ?

    Read the article

  • sqlite & python - only pulls the first result

    - by pencilNero
    This is pretty strange (admitedly, this is my first attempt with python / sqlite), but I can seem to get all of the rows if I do a fetchAll(), but other than that - no matter what I try, always ends up in the db only returning the first row - the second iteration stops because a null is returned. Wondering if there is something wrong with how I am coding this up in python? The db seems ok.. con = sqlite3.connect('backup.db') con.row_factory = sqlite3.Row cur = con.cursor() cur.execute('select * from tb1;') for row in cur: try: # row = dataCur.fetchone() #if row == None: break print type(row) print ' Starting on: %i' % row[0] cleaner = Cleaner(scripts=True, remove_tags=['img'], embedded=True) try: cleaned = cleaner.clean_html(row[2]) #data stored in second col cur.execute('update tb1 set data = ? where id = ?;', (cleaned, row[0])) except AttributeError: print 'Attribute error' print ' Ended on: %i' % row[0] except IOError: print 'IOexception'

    Read the article

  • Python - removing double quotation marks " so that script runs

    - by andrew k
    I am using Python scripts to edit the table of many shape files. The following script runs fine, but if there are any " marks in the SIT_FULL_S field, the script errors and shuts down. gp.CalculateField_management(fc + "\\Parcels.shp","SIT_FULL_S", "!SIT_FULL_S!.lstrip('0')", "PYTHON") arcgisscripting.ExecuteError: ERROR 000539: Error running expression: "9030 W SR 2 HWY "A"".lstrip('0') <type 'exceptions.SyntaxError'>: invalid syntax (<string>, line 1) Failed to execute (CalculateField). I have two options, create a new script that runs through and deletes all occurances of ", and then run the above script or modify the above script to ignore the " and contiue running. Can anyone help ?

    Read the article

  • python streaming TCP server with RPC

    - by Noah
    I have written a little streaming mp3 server in python. So far all it does is accept a ServerSocket connection, and begin streaming all mp3 data in its queue to the request using socket.send(). I have implemented this to chunk in stream icy metadata, so the name of the playing song shows up in the client. I would like to add playlist management to the server, so that I can manipulate the playlist of the running server. I have a vague idea that xmlrpclib would be suited to doing this, but I'm confused about one thing: When I start the server it listens on port N. The python xmlrpclib examples involve creating a socket and listening for requests. So my question is should server listen on two ports; i.e., one for streaming client requests and one for xmlrpclib calls, or is there a way to do it by somehow delegating the request to the appropriate handler based on its type?

    Read the article

< Previous Page | 66 67 68 69 70 71 72 73 74 75 76 77  | Next Page >