Search Results

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

Page 55/608 | < Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >

  • Properties of mbox message in mbox module in Python

    - by Rajasankar
    I trying my luck to manage my mailbox with python. My example code is for eachmail in mailbox.mbox(mboxfile): print eachmail['From'] I got following by printing entire content. Delivered-To Subject To Content-Type MIME-Version Message-Id Is there any full document showing what are all the properties I can get from the mbox message instance? Python docs doesn't specify any of these http://docs.python.org/library/mailbox.html#mailbox.mbox

    Read the article

  • File size in Python server

    - by Anna
    We have server on Python and client + web service on Ruby. That works only if file from URL is less than 800 k. It seems like "socket.puts data" in a client works, but "output = socket.gets" - not. I think problem is in a Python part. For big files tests run "Connection reset by peer". Is it buffer size variable by default somewhere in a Python?

    Read the article

  • Python: Using `copyreg` to define reducers for types that already have reducers

    - by cool-RR
    (Keep in mind I'm working in Python 3, so a solution needs to work in Python 3.) I would like to use the copyreg module to teach Python how to pickle functions. When I tried to do it, the _Pickler object would still try to pickle functions using the save_global function. (Which doesn't work for unbound methods, and that's the motivation for doing this.) It seems like _Pickler first tries to look in its own dispatch for the type of the object that you want to pickle before looking in copyreg.dispatch_table. I'm not sure if this is intentional. Is there any way for me to tell Python to pickle functions with the reducer that I provide?

    Read the article

  • Using Variables for Class Names in Python?

    - by Sam McAfee
    I want to know how to use variables for objects and function names in Python. In PHP, you can do this: $className = "MyClass"; $newObject = new $className(); How do you do this sort of thing in Python? Or, am I totally not appreciating some fundamental difference with Python, and if so, what is it?

    Read the article

  • Programatically importing a file and creating an instance of a class in Python

    - by benofsky
    I have a (python) list of strings which refer to python source files and subsequently classes within those files which I want to import and then create an instance of the classes within the files (everything follows a strict naming convention, making this theoretically possible), in Ruby I would do something like: require "lib/sources/#{source}.rb" s = source.constantize.new How would I do something similar in Python? Thanks, Ben

    Read the article

  • Python urlparse, correct or incorrect?

    - by omfgroflmao
    Python's urlparse function parses an url into six components (scheme, netloc, path and others stuff) Now I've found that parsing "example.com/path/file.ext" return no netloc but a path "example.com/path/file.ext". Should't it be netloc = "example.com" and path = "/path/file.ext"? Do we really need a "://" to determine wether or not a netloc exists? Python's ticket: http://bugs.python.org/issue8284

    Read the article

  • C++ boost thread id and Singleton

    - by aaa
    hi. Sorry to flood so many questions this week. I assume thread index returned by thread.get_id is implementation specific. In case of the pthreads, is index reused? IE, if thread 0 runs and joins, is thread launched afterwords going to have a different ID? the reason I ask this is a need to implement Singleton pattern with a twist: each thread gets its own instance. I know it sounds very crazy, but threads control hardware (cuda) which does not permit device memory sharing. What is a good way to implement such pattern?

    Read the article

  • Unexpected output using subprocess in Python

    - by Vic
    I am trying to run a shell command from within my Python (version 2.6.5) code, but it is generating different output than the same command run within the shell (bash): bash: ~> ifconfig eth0 | sed -rn 's/inet addr:(([0-9]{1,3}\.){3}[0-9]{1,3}).*/\1/p' | sed 's/^[ \t]*//;s/[ \t]*$//' 192.168.1.10 Python: >>> def get_ip(): ... cmd_string = "ifconfig eth0 | sed -rn \'s/inet addr:(([0-9]{1,3}\.){3}[0-9]{1,3}).*/\1/p' | sed 's/^[ \t]*//;s/[ \t]*$//\'" ... process = subprocess.Popen(cmd_string, shell=True, stdout=subprocess.PIPE) ... out, err = process.communicate() ... return out ... >>> get_ip() '\x01\n' My guess is that I need to escape the quotes somehow when running in python, but I am not sure how to go about this. NOTE: I cannot install additional modules or update python on the machine that this code needs to be run on. It needs to work as-is with Python 2.6.5 and the standard library.

    Read the article

  • Question about python modules

    - by morpheous
    I have recently started learning Python and I have 2 questions relating to modules. Is there a way to obtain a list of Python modules available (i.e. installed) on a mchine? I am using Ubuntum Karmic and Synaptic for package management. I have just installed a python module.Where is the module code actually stored on my machine? (is there a default [recommended] location that modules are stored)?

    Read the article

  • CURL alternative in Python

    - by Gaurav
    I have a cURL call that I use in PHP: curl -i -H 'Accept: application/xml' -u login:key "https://app.streamsend.com/emails" I need a way to do the same thing in Python. Is there an alternative to cURL in Python. I know of urllib but I'm a Python noob and have no idea how to use it.

    Read the article

  • python: where to put application data that can be edited by computer users

    - by Jason S
    I'm working on a really simple python package for our internal use, and want to package it as a .egg file, and when it's installed/used I want it to access a text file that is placed in an appropriate place on the computer. So where is the best place to put application data in python? (that is meant to be edited by users) How do I get my python package to automatically install a default file there?

    Read the article

  • Java/Python: Integration, problem with looping updating text

    - by Jivings
    Hello! Basically I have a script in Python that grabs the text from an open window using getWindowText() and outputs it to the screen. The python loops so as the text in the window changes, it outputs the changes, so the output of the python will always be up to date with the window text. I'm trying to access this text in my Java program by executing the python script as a process and reading the text it outputs using a buffered reader. For some reason this works fine for the first block of text, but will not read any more after this, it wont read any updates to the text as the python outputs it. Can someone shed some light on this? I'm about to try and use Jython, but I'd really like to know what the problem is here... try { Runtime r = Runtime.getRuntime(); Process p = r.exec("cmd /c getText.py"); BufferedReader br = new BufferedReader( new InputStreamReader(p.getInputStream())); int line; while (true) { line = br.read(); System.out.print((char) line); } } catch (Exception e) { e.printStackTrace(); }

    Read the article

  • Controlling rsync with Python?

    - by Cheesemold
    I've been wanting to write a python script that would run several instances of rsync in sequence for backing up data to a different computer. At the moment I just have this text file with the commands I use and I've just been copy-pasting them into the terminal, and it seems kinda silly. I want to be able to use python to do this for me. I know very vaguely how to use subprocess.popen, but I have no clue how to get python to interact with rsync directly, like for entering my password for me. Can python do that? Something like: if theProccess.proccessResponse == "Password:" : theProccess.respond(string) Or is the best that I can do is just have it, or even a bash script, just run the rsyncs in sequence and have to type my password in over and over again? Thanks in advance.

    Read the article

  • Save the output of a command in a string in linux using python

    - by user1657901
    I am using Fedora 17 xfce and I am programming in Python 2.7.3. Fedora uses a package manager called yum. I have a python script that searches for packages like this: import os package = raw_input("Enter package name to search: ") os.system("yum list " + package) So I want python to check if in the output of this command exists the words "No matching packages to list". I checked a similar question and I tried some methods [http://stackoverflow.com/questions/2502833/python-store-output-of-subprocess-call-in-a-string][1] but the string contained only the first line of the output. Thanks in advance

    Read the article

  • syntax difference between ruby and python?

    - by fayer
    i wonder if there are tutorials that go through the syntax differences for ruby and python? i have seen a comparison between ruby and php but not between ruby and python. i have looked at both ruby and python but it would be very useful with this side-by-side comparison for deciding which one to choose. thanks

    Read the article

  • Making swedish characthers show properly in Windows Command Prompt using Python in Notepad++

    - by Alex
    The title explains it well. I have set up Notepad++ to open the python script in the command prompt when I press F8 but all Swedish characters looks messed up when opening in CMD but perfectly fine in e.g IDLE. This simple example code: #!/usr/bin/env python #-*- coding: UTF-8 -*- print "åäö" Looks like this. As you can see the output of the bath file I use to open Python in cmd below shows the characthers correctly but not the python script above it. How do i fic this?

    Read the article

  • Micropython or minimal python installation

    - by reshefm
    I once read about minimal python installation without a lot of the libraries that come with the python default installation but could not find it on the web... What I want to do is to just pack a script with the python stuff required to execute it and make portable. Does any one know about something like that? Thanks

    Read the article

  • Boost ForEach Question

    - by bobber205
    Trying to use something like the below with a char array but it doesn't compile. But the example with short[] works fine. Any idea why? :) char someChars[] = {'s','h','e','r','r','y'}; BOOST_FOREACH(char& currentChar, someChars) { } short array_short[] = { 1, 2, 3 }; BOOST_FOREACH( short & i, array_short ) { ++i; }

    Read the article

  • D_WIN32_WINNT compiler warning with Boost

    - by bobber205
    Not sure what to make of this error. Added -D_WIN32_WINNT=0x0501 to Visual Studio's "Command Line" options under Project Properties but it says it doesn't recognize it and the warning still appears. I am also not sure how to add the Preprocessor Definition. :) Thanks for any help! 1Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example: 1- add -D_WIN32_WINNT=0x0501 to the compiler command line; or 1- add _WIN32_WINNT=0x0501 to your project's Preprocessor Definitions.

    Read the article

< Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >