Search Results

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

Page 10/608 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Boost Python : How to only expose the constructor of a class with virtual (pure & impure) methods

    - by fallino
    Hello, I'm a newbie with Boost::Python but I tried to search on the web to do so I want to expose a 3rd party library to Python. One of the class of the library (.hpp) is composed of a public constructor with arguments a protected constructor and functions various regular functions various pure virtual functions various non pure virtual functions First, I did not succeed in building it without having errors about this protected constructor. I finally commented it. A first question would be : Is there a way to exclude these protected functions since I don't want to expose them ? (I know it's possible and easy with Py++, but I started without using it) Then I tried to expose all of my functions, beginning with the pure virtual ones (commenting them all except one), which wasn't a success too So I finally decided not to expose these virtual functions (which in fact seems logical...), but, here again, I didn't manage building it with a simple constructor with arguments (without no_init). So my second question is : Is there a way to exclude these virtual functions since I don't want to expose them ? Sorry if it seems trivial but I didn't find anything explicit on the web and I need something rather explicit :). Thanks in advance

    Read the article

  • BOOST program_options: parsing multiple argument list.

    - by Arman
    Hello, I would like to pass the multiple arguments with positive or negative values. Is it possible to parse it? Currently I have a following initialization: vector<int> IDlist; namespace po = boost::program_options; po::options_description commands("Allowed options"); commands.add_options() ("IDlist",po::value< vector<int> >(&IDlist)->multitoken(), "Which IDs to trace: ex. --IDlist=0 1 200 -2") ("help","print help") ; and I would like to call: ./test_ids.x --IDlist=0 1 200 -2 unknown option -2 So,the program_options assumes that I am passing -2 as an another option. Can I configure the program_options in such a way that it can accept the negative integer values? Thanks Arman.

    Read the article

  • Boost interprocess cached pools

    - by porgarmingduod
    I'm trying to figure out if my reading of the docs for boost interprocess allocators is correct. When using cached_adaptive_pool to allocate memory: typedef cached_adaptive_pool<int, managed_shared_memory::segment_manager> pool_allocator_t; pool_allocator_t pool_allocator(segment.get_segment_manager()); // Allocate an integer in the shared memory segment pool_allocator_t::pointer pool_allocator.allocate_one(); My understanding is that with multiple processes one can allocate and deallocate freely: That is, if I have a cached pool allocator for integers in one process, then it can deallocate integers allocated by similar pools in other processes (provided, of course, that they are working on the same shared memory segment). It may be a stupid question, but working with multiple processes and shared memory is hard enough, so I'd like to know 100% whether I got the basics right.

    Read the article

  • boost for each problem

    - by areslp
    std::map< std::string , std::string > matrix_int; typedef std::pair< std::string , std::string > lp_type; BOOST_FOREACH( lp_type &row, matrix_int ){ } this can not be complied: error C2440: 'initializing' : cannot convert from 'std::pair<_Ty1,_Ty2' to 'lp_type &' when I have ',' in element type, boost doc says I can use typedef or predefine a var; but what should I do when I want to get a reference?

    Read the article

  • Implementing Qt File Dialog with a Different File System Library (boost)

    - by knight
    Hi, I am writing an application which requires me to use another file system and file engine handlers and not the qt's default ones. Basically what I want to be able to do is to use qt's file dialog but have an underlying file system handler (for example built using boost file system library) of mine handling all the operations with regards to file and directory operations within that dialog. I have already written a custom file engine which handles some of the operations but I am now stuck with Qt's file system model and the file system watcher engine, as I need to have the signals transmitted for this custom file engine. Seems like I have a daunting task ahead. Am I heading in the right direction? Is there any other simpler way that I could implement this? Can anyone give me any idea on how to proceed. I was thinking of looking into proxy models but not sure if that would work. Thanks in advance for any help.

    Read the article

  • Boost::asio bug in MSVC10 - Failing BOOST_WORKAROUND in ~buffer_debug_check() in buffer.hpp

    - by shaz
    A straight compilation of example http://www.boost.org/doc/libs/1_43_0/doc/html/boost_asio/tutorial/tutdaytime3/src.html results in a runtime null pointer exception. Stack trace points to the buffer_debug_check destructor which contains this comment: // MSVC's string iterator checking may crash in a std::string::iterator // object's destructor when the iterator points to an already-destroyed // std::string object, unless the iterator is cleared first. The test #if BOOST_WORKAROUND(BOOST_MSVC, = 1400) succeeds in MSVC10 and (but) results in a null pointer exception in c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility line 123 _Iterator_base12& operator=(const _Iterator_base12& _Right) { // assign an iterator if (_Myproxy != _Right._Myproxy) _Adopt(_Right._Myproxy->_Mycont); return (*this); } _Right._Myproxy is NULL

    Read the article

  • Java PlayFramework & Python Django GAE

    - by Maik Klein
    I already know Java, C# and C++. Now I want to start with web development and I saw that some really big sites are built with Python/C++. I like the coding style of Python, it looks really clean, but some other things like no errors before runtime is really strange. However, I don't know what I should learn now. I started with Python but then I saw that Google App Engine also supports Java and the PlayFramework looks amazing too. Now I am really confused. Should I go with Python or Java? I found the IDE for Python "PyCharm" really amazing for web development. Does Java have something similar, eclipse maybe? I know that this question isn't constructive, but it will help me with my decision. What are pro and cons of both languages?

    Read the article

  • Convertion of tiff image in Python script - OCR using tesseract

    - by PYTHON TEAM
    I want to convert a tiff image file to text document. My code perfectly as I expected to convert tiff images with usual font but its not working for french script font . My tiff image file contains text. The font of text is in french script format.I here is my code import Image import subprocess import util import errors tesseract_exe_name = 'tesseract' # Name of executable to be called at command line scratch_image_name = "temp.bmp" # This file must be .bmp or other Tesseract-compatible format scratch_text_name_root = "temp" # Leave out the .txt extension cleanup_scratch_flag = True # Temporary files cleaned up after OCR operation def call_tesseract(input_filename, output_filename): """Calls external tesseract.exe on input file (restrictions on types), outputting output_filename+'txt'""" args = [tesseract_exe_name, input_filename, output_filename] proc = subprocess.Popen(args) retcode = proc.wait() if retcode!=0: errors.check_for_errors() def image_to_string(im, cleanup = cleanup_scratch_flag): """Converts im to file, applies tesseract, and fetches resulting text. If cleanup=True, delete scratch files after operation.""" try: util.image_to_scratch(im, scratch_image_name) call_tesseract(scratch_image_name, scratch_text_name_root) text = util.retrieve_text(scratch_text_name_root) finally: if cleanup: util.perform_cleanup(scratch_image_name, scratch_text_name_root) return text def image_file_to_string(filename, cleanup = cleanup_scratch_flag, graceful_errors=True): If cleanup=True, delete scratch files after operation.""" try: try: call_tesseract(filename, scratch_text_name_root) text = util.retrieve_text(scratch_text_name_root) except errors.Tesser_General_Exception: if graceful_errors: im = Image.open(filename) text = image_to_string(im, cleanup) else: raise finally: if cleanup: util.perform_cleanup(scratch_image_name, scratch_text_name_root) return text if __name__=='__main__': im = Image.open("/home/oomsys/phototest.tif") text = image_to_string(im) print text try: text = image_file_to_string('fnord.tif', graceful_errors=False) except errors.Tesser_General_Exception, value: print "fnord.tif is incompatible filetype. Try graceful_errors=True" print value text = image_file_to_string('fnord.tif', graceful_errors=True) print "fnord.tif contents:", text text = image_file_to_string('fonts_test.png', graceful_errors=True) print text

    Read the article

  • How to familiarize myself with Python

    - by Zel
    I am Python beginner. Started Python 1.5 months back. I downloaded the Python docs and read some part of the tutorial. I have been programming on codechef.com and solving problems of projecteuler. I am thinking of reading Introduction to algorithms and following this course on MIT opencourse ware as I haven't been getting much improvement in programming and I am wasting much time thinking just what should I do when faced with any programming problem. But I think that I still don't know the correct way to learn the language itself. Should I start the library reference or continue with Python tutorial? Is learning algorithms useful for language such as C and not so much for Python as it has "batteries included"? Are there some other resources for familiarization with the language and in general for learning to solve programming problems? Or do I need to just devote some more time?

    Read the article

  • Typing commands into a terminal always returns "-bash: /usr/bin/python: is a directory"

    - by Artur Sapek
    I think I messed something up on my Ubuntu server while trying to upgrade to Python 2.7.2. Every time I type in a command that doesn't have a response, the default from bash is this: -bash: /usr/bin/python: is a directory Just like it would say if I typed the name of a directory. But this happens every time I enter a command that doesn't do anything. artur@SERVER:~$ dslkfjdsklfdshjk -bash: /usr/bin/python: is a directory I remember messing with the update-alternatives to point at python at some point, perhaps that could be it? Any inklings as to why this is happening? Related to this problem is also the fact that when I try using easy_install it tells me -bash: /usr/bin/easy_install: /usr/bin/python: bad interpeter: Permission denied /etc/fstab/ is set to exec. I've read that could fix the second problem but it hasn't.

    Read the article

  • How to make a python script run in Anacron

    - by Jeremy
    I have a python script that I would like to run daily using anacron, but I haven't been able to get it to work. The script is in my home directory, and I have put a symlink to it in /etc/cron.daily/. I saw somewhere that things here can't have dots in the filename, so the symlink has the .py extension removed (the original file still has it). The python file does have #!/usr/bin/python on the first line. This is my first experience with cron / anacron, and so I'm sure I'm making a dumb mistake - I just don't know what it is. Is a symlink a problem? Do I need the actual file there? Is the python script the problem? Do I need to run a bash script that will open the python script? Is there something else I'm not thinking of?

    Read the article

  • Python script as a service on Ubuntu 11.10

    - by bugs99
    I am facing the following problem. I want to run a python script as a service on Ubuntu 11.10 system (already mentioned in the following link: Python service using Upstart on Ubuntu) I followed the steps mentioned in the above mentioned link, but i got the following error message in syslog: init: script main process (21826) terminated with status 1 Jun 8 16:59:55 bilbo kernel: [263012.984531] init: script main process ended, respawning Jun 8 16:59:55 bilbo kernel: [263013.044099] init: script main process (21827) terminated with status 1 The above two lines are getting repeated all the time. On saying sudo start script, I get the following: $ sudo start script script start/running, process 21826 Following is the content of my script.conf placed in /etc/init: description "Used to start python script as a service" author "bilbo" start on runlevel [2] stop on runlevel [06] exec python /home/bilbo/scripts/webserver.py respawn Please tell me what I am doing wrong? Do I have to change my python code as well?

    Read the article

  • How to install Visual Python?

    - by user214152
    I'm a Linux newbie but I'm determined to get my favorite applications on my laptop running Ubuntu 12.04. I just installed Cinnamon. I'm trying to install Visual Python and it requires Python 2.7. I followed the instructions on the VPython site but the Wine application isn't extracting anything from the Python .msi file. From the first line wine start /i python-2.7.5.amd64.msi /qn TARGETDIR=~/Python27 ALLUSERS=1 it says fixme:storage:create_storagefile Storage share mode not implemented. I created that Python27 directory so I know it exists and it's empty. I know Ubuntu already has Python 2.7 so I just tried running the VPython.exe file but it says "This program can only be installed on versions of Windows designed for the following processor architectures: x64." My Toshiba satellite has a 64-bit processor. Could anybody help?

    Read the article

  • Python repl in python application

    - by Olorin
    Hello i am learning python(so i can use qt with python not only c++) and i'm curios if it would be possible to embed a python interpreter in my application as a repl. I would like to give users to possibility to script the app using python either loading a file (and that file to act as a plugin for the app) or by evaluating code entered in a text box or something like that. Just like you can embed the interpreter in C or C++ and script the app using python can this be done if the application is itself written in python(and made a stand-alone binary using py2exe or something similar)? something like Anders did with the C# repl or Miguel with mono. Thanks.

    Read the article

  • Using Python on Mac

    - by choise
    hi, i want to learn python using my mac. now i want to setup a python version = 3.1.3, because my materials for learning are using this version. typing python into terminal results version 2.6.1, using the dmg installer on python.org (http://docs.python.org/ftp/python/3.1.3/) doesn't have an effect on the python version in terminal, but it's bundled with an own shell under Applications/Python 3.1/Idle.app my question now is, should i use this shell for learing or is there a better way, updating the python version bundled with snow leopard? i already tried defaults write com.apple.versioner.python Version 3.1.3 or defaults write com.apple.versioner.python Version 3.0 without any result. thanks!

    Read the article

  • Until when will Python 2.5 be supported?

    - by Emilien
    Apparently Python only supports 2 minor versions (like 2.X), so that would mean Python 2.5 would get phased out when Python 2.7 comes out (in June 2010?) Is this correct? PEP 356 -- Python 2.5 Release Schedule doesn't give much answers to this question.

    Read the article

  • No IDLE for Python 3?

    - by NotSuper
    I installed Python 3.1 yesterday on my Windows Vista PC, and was surprised to find that the version of IDLE is 2.6.4, for "Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32" I was hoping to use IDLE to investigate some of the new features of Python 3... I guess I'm stuck with the command line... Anyone know what's up with Python 3's IDLE? Thanks

    Read the article

  • Building MySQL with boost on windows

    - by user13177919
    As you've probably heard already MySQL needs boost to build. However, in the good ol' MySQL tradition, the above link does give you only the instructions on how to build it on linux. And completely ignores the fact that there're other OSes too that people develop on. To fill in that gap, I've compiled a small step by step guide on how to do it on windows. Note that I always, as a principle, build out-of-source. The typical setup I have is : bzr clone lp:~mysql/mysql-server/5.7 mysql-trunkcd mysql-trunkmkdir bldcd bldcmake -DWITH_DEBUG=1 -DMYSQL_PROJECT_NAME=mysql-trunk ..devenv /build debug mysql-trunk.sln This has been tested to work on a 32 bit compile using VS2013 on a Windows7 64 bit build. Note that you'll need other things too (bison, eventually openssl etc) that I will assume you already have set up. Steps: Download Boost 1.55.0. It's the *only* version that is known to work currently. Extract boost_1_55_0/ from the zip to c:\boost\boost_1_55_0 Go to Control Panel/System/Environment variables and set WITH_BOOST=C:\boost\boost_1_55_0 in User variables. Make sure you restart your open command line terminal windows after this !  If you're upgrading from non-boost build, remove your bld/ directory and create a new one. run cmake as you'd typically do. You should get: -- Local boost dir C:/boost/boost_1_55_0 -- Local boost zip LOCAL_BOOST_ZIP-NOTFOUND -- BOOST_VERSION_NUMBER is #define BOOST_VERSION 105500 -- BOOST_INCLUDE_DIR C:/boost/boost_1_55_0 Build as normal (devenv /build debug ...). It should work.

    Read the article

  • Why use Python interactive mode?

    - by mvid
    When I first started reading about Python, all of the tutorials have you use Python's Interactive Mode. It is difficult to save, write long programs, or edit your existing lines (for me at least). It seems like a far more difficult way of writing Python code than opening up a code.py file and running the interpreter on that file. python code.py I am coming from a Java background, so I have ingrained expectations of writing and compiling files for programs. I also know that a feature would not be so prominent in Python documentation if it were not somehow useful. So what am I missing?

    Read the article

  • Avoiding accidentally catching KeyboardInterrupt and SystemExit in Python 2.4

    - by jrdioko
    In Python scripts, there are many cases where a keyboard interrupt (Ctrl-C) fails to kill the process because of a bare except clause somewhere in the code: try: foo() except: bar() The standard solution in Python 2.5 or higher is to catch Exception rather than using bare except clauses: try: foo() except Exception: bar() This works because, as of Python 2.5, KeyboardInterrupt and SystemExit inherit from BaseException, not Exception. However, some installations are still running Python 2.4. How can this problem be handled in versions prior to Python 2.5? (I'm going to answer this question myself, but putting it here so people searching for it can find a solution.)

    Read the article

  • trouble with boost::filesystem::wrecursive_directory_iterator

    - by Dogmatixed
    I'm trying to write a program to help me manage my iTunes library, including removing duplicates and cataloging certain things. At this point I'm still just trying to get it to walk through all the folders, and have run into a problem: I have a small amount of Japanese music, where the artist and/or album is written in Japanese characters. Because of how iTunes arranges things in its library the directories contain these characters. "shouldn't be a problem, though." I thought, because the boost::filesystem library has a wide character version of its recursive iterator. but when I actually try to use it, it seems to completely stop when it hits the first Japanese char. complete stop as in it doesn't finish printing the line, no carriage return or anything. now, I'm still pretty new to programming, so I'm assuming it's my mistake, anyone know why this is happening? here's what I think is the relevant code: fs::wrecursive_directory_iterator end_it; int i; try { for(fs::wrecursive_directory_iterator rec_it(full_path); rec_it != end_it; ++rec_it) { for(i = 0; i < rec_it.level(); i++) { out << "\t"; } out << rec_it->string() << std::endl; } } catch(std::exception e) { out << "something went wrong: " << e.what(); } and from my output file, minus some of the path: /Test Libs/Combine /Test Libs/Lib1 /Test Libs/Lib1/02 Too Long.m4a /Test Libs/Lib1/03 Like a Hitman, Like a Dancer.mp3 /Test Libs/Lib1/A Certain Ratio /Test Libs/Lib1/A Certain Ratio/Beyond Punk! /Test Libs/Lib1/A Certain Ratio/Unknown Album /Test Libs/Lib1/A Certain Ratio/Unknown Album/Do The Du.mp3 /Test Libs/Lib1/A Certain Ratio/Unknown Album/Shack Up.mp3 /Test Libs/Lib1/ finally, what I expect: /Test Libs/Combine /Test Libs/Lib1 /Test Libs/Lib1/02 Too Long.m4a /Test Libs/Lib1/03 Like a Hitman, Like a Dancer.mp3 /Test Libs/Lib1/A Certain Ratio /Test Libs/Lib1/A Certain Ratio/Beyond Punk! /Test Libs/Lib1/A Certain Ratio/Unknown Album /Test Libs/Lib1/A Certain Ratio/Unknown Album/Do The Du.mp3 /Test Libs/Lib1/A Certain Ratio/Unknown Album/Shack Up.mp3 /Test Libs/Lib1/??? /Test Libs/Lib1/Bring it on /Test Libs/Lib1/04 Bring it on.mp3 any thoughts? Thanks.

    Read the article

  • linking to boost regex in gcc

    - by rboorgapally
    i am trying to compile my program which uses regex on linux. I built the boost library in the libs/regex/build by typing make -fgcc.mak which created a directory gcc which contains the following four files boost_regex-gcc-1_35 boost_regex-gcc-d-1_35 libboost_regex-gcc-1_35.a libboost_regex-gcc-d-1_35.a Now I want to use regex from my program which is in some arbitrary directory. I #included boost/regex.hpp I got the error which stated that regex.hpp is not found. Then I gave the -I option in the g++ compiler. I didn't get that error. But I get the following error undefined reference to `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::construct_init(boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags)' I googled and found that I need to somehow link one of the above 4 libraries to my program. How can I do it. Which one should I link and why?

    Read the article

  • Having a Python package install itself under a different name

    - by cool-RR
    I'm developing a package called garlicsim. (Website.) The package is intended for Python 2.X, but I am also offerring Python 3 support on a different fork called garlicsim_py3.(1) So both of these packages live side by side on PyPI, and Python 3 users install garlicsim_py3, and Python 2 users install garlicsim. The problem is: When third party modules want to use garlicsim, they should have one package name to refer to, not two. Sure, they can do something like this: try: import garlicsim except ImportError: import garlicsim_py3 as garlicsim But I would prefer not to make the developers of these modules do this. Is there a way that garlicsim_py3 will install itself under the alias garlicsim? What I want is for a Python 3 user to be able to import garlicsim and refer to the module all the time as garlicsim, but that it will really be garlicsim_py3. I know that the Distribute project does something like this: They make it so you can import setuptools and it will be redirected into their code. I have no idea how they do it. Any ideas? (1) I've reached the decision to support Python 3 on a fork instead of in the same code base; It's important for me that the code base will be clean, and I would really not want to introduce compatibilty hacks.

    Read the article

  • How to use boost normal distribution classes?

    - by David Alfonso
    Hi all, I'm trying to use boost::normal_distribution in order to generate a normal distribution with mean 0 and sigma 1. The following code uses boost normal classes. Am I using them correctly? #include <boost/random.hpp> #include <boost/random/normal_distribution.hpp> int main() { boost::mt19937 rng; // I don't seed it on purpouse (it's not relevant) boost::normal_distribution<> nd(0.0, 1.0); boost::variate_generator<boost::mt19937&, boost::normal_distribution<> > var_nor(rng, nd); int i = 0; for (; i < 10; ++i) { double d = var_nor(); std::cout << d << std::endl; } } The result on my machine is: 0.213436 -0.49558 1.57538 -1.0592 1.83927 1.88577 0.604675 -0.365983 -0.578264 -0.634376 As you can see all values are not between -1 and 1. Thank you all in advance!

    Read the article

  • [C++][Boost] Acceptor and Problems with Async_Accept

    - by bobber205
    See code. :P I am able to receive new connections before async_accept() has been called. My delegate function is also never called so I can't manage any connections I receive, rendering the new connections useless. ;) So here's my question. Is there a way to prevent the Boost ASIO acceptor from getting new connections on its own and only getting connections from async_accept()? Thanks! bool AlexSocket::StartListening(int port) { bool didStart = false; if (!this->listening) { //try to listen acceptor = new tcp::acceptor(this->myService); boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), port); acceptor->open(endpoint.protocol()); acceptor->set_option(boost::asio::ip::tcp::acceptor::reuse_address(true)); acceptor->bind(endpoint); //CAN GET NEW CONNECTIONS HERE (before async_accept is called) acceptor->listen(); didStart = true; //probably change? tcp::socket* tempNewSocket = new tcp::socket(this->myService); acceptor->async_accept(*tempNewSocket, boost::bind(&AlexSocket::NewConnection, this, tempNewSocket, boost::asio::placeholders::error) ); } else //already started! return false; this->listening = didStart; return didStart; } //this function is never called :( void AlexSocket::NewConnection(tcp::socket* s, const boost::system::error_code& error) { cout << "New Connection Made" << endl; //Start new accept async tcp::socket* tempNewSocket = new tcp::socket(this->myService); acceptor->async_accept(*tempNewSocket, boost::bind(&AlexSocket::NewConnection, this, tempNewSocket, boost::asio::placeholders::error) ); }

    Read the article

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