Search Results

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

Page 43/608 | < Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >

  • python sqlite fails

    - by lakshmipathi
    My program uses sqlite3 plus python. It works fine with python 2.6.2 I moved it another machine and installed 2.6.4 and running the program gave me this error File "", line 1, in File "/opt/python-2.6.4/lib/python2.6/sqlite3/init.py", line 24, in from dbapi2 import * File "/opt/python-2.6.4/lib/python2.6/sqlite3/dbapi2.py", line 27, in from _sqlite3 import * ImportError: No module named _sqlite3

    Read the article

  • A Question about using jython when run a receving socket in python

    - by abusemind
    Hi, I have not a lot of knowledge of python and network programming. Currently I am trying to implement a simple application which can receive a text message sent by the user, fetch some information from the google search api, and return the results via text message to the user. This application will continue to listening to the users messages and reply immediately. How I get the text short message sent by the user? It's a program named fetion from the mobile supplier in China. The client side fetion, just like a instant communication tool, can send/receive messages to/from other people who are using mobile to receive/send SMS. I am using a open source python program that simulates the fetion program. So basically I can use this python program to communate with others who using cell phone via SMS. My core program is based on java, so I need to take this python program into java environment. I am using jython, and now I am available to send messages to users by some lines of java codes. But the real question is the process of receving from users via SMS. In python code, a new thread is created to continuously listen to the user. It should be OK in Python, but when I run the similar process in Jython, the following exception occurs: Exception in thread Thread:Traceback (most recent call last): File "D:\jython2.5.1\Lib\threading.py", line 178, in _Thread__bootstrap self.run() File "<iostream>", line 1389, in run File "<iostream>", line 1207, in receive File "<iostream>", line 1207, in receive File "<iostream>", line 150, in recv File "D:\jython2.5.1\Lib\select.py", line 223, in native_select pobj.register(fd, POLLIN) File "D:\jython2.5.1\Lib\select.py", line 104, in register raise _map_exception(jlx) error: (20000, 'socket must be in non-blocking mode') The line 150 in the python code is as follows: def recv(self,timeout=False): if self.login_type == "HTTP": time.sleep(10) return self.get_offline_msg() pass else: if timeout: infd,outfd,errfd = select([self.__sock,],[],[],timeout)//<---line 150 here else: infd,outfd,errfd = select([self.__sock,],[],[]) if len(infd) != 0: ret = self.__tcp_recv() num = len(ret) d_print(('num',),locals()) if num == 0: return ret if num == 1: return ret[0] for r in ret: self.queue.put(r) d_print(('r',),locals()) if not self.queue.empty(): return self.queue.get() else: return "TimeOut" Because of I am not very familiar with python, especially the socket part, and also new in Jython use, I really need your help or only advice or explanation. Thank you very much!

    Read the article

  • missing ';' before namespace when using boost 1.4.2

    - by Adam Haile
    Working on moving some C++ code from Linux over to Windows. The code uses boost 1.4.2, however it keeps failing out on building the boost modules. Basically, every boost hpp file that happens to contain "namespace boost" errors with: error C2143: syntax error : missing ';' before 'namespace' Any idea what could be causing this?

    Read the article

  • Why does Python Array Module Process Strings and Lists Differently?

    - by Casey
    I'm having trouble understanding the result of the following statements: >>> from array import array >>> array('L',[0xff,0xff,0xff,0xff]) array('L', [255L, 255L, 255L, 255L]) >>> from array import array >>> array('L','\xff\xff\xff\xff') Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: string length not a multiple of item size

    Read the article

  • problem with python script

    - by hidayat
    I want to run a csh file from a python scrip, example, #!/usr/bin/python import os os.system("source path/to/file.csh") and I want this file to run in the same shell as I am running the python script, because the file.csh script is settings some environment variables that I need. Does anyone know how to do this in Python?

    Read the article

  • Python-How to call up a function from another module?

    - by user2691540
    I am making a project where I need several modules which are imported into one main module to make a pizza ordering service. Upon finishing this (to a working standard) I decided to re-code it so that the whole order is completed with one tkinter window, now instead of using input(), I use tkinter.Entry() etc. etc. To do this I had to use functions for each step so it is broken up nicely, e.g. the code asks if the user wants pickup or delivery, the user clicks a button which sets some variables and one of the buttons is then configured to say "continue" and the command leads to the next step of the pizza ordering process e.g. getting the name. The problem I have is that when I get past the last function of the first module the configured button has a command to go to a function in the second module, but it says that the command is not defined??? I have tried my way around this but cannot import the configured button variable into the next module, and anything else I tried gave no result, it simply doesn't go to the next module after the first module is done. I have made the main tkinter window in the main module and have it that it will mainloop after importing the other modules so shouldn't the function I want to call upon be defined? How can I get from one function to the next if the latter is in a seperate module? Is this possible or do I have to rethink my approach and if so how? Ok then, have made some more code to show what my problem is, this isn't what I am actually using but it's a lot shorter and has the same issue: this is the main module: import tkinter mainwindow = tkinter.Tk() # here i set the window to a certain size etc. import mod1 import mod2 mainwindow.mainloop() this is mod1: import tkinter def button1(): label.destroy() button1.destroy() button2.config(text = "continue", command = func2) def button2(): label.destroy() button1.destroy() button2.config(text = "continue", command = func2) label = tkinter.Label(text = "example label") button1 = tkinter.Button(text = "button1", command = button1) button2 = tkinter.Button(text = "button2", command = button2) label.pack() button1.pack() button2.pack() this is mod2: def func2(): button2.destroy() print ("haha it works...") I still get the problem that func2 is not defined? Thanks in advance

    Read the article

  • Problem installing MySQLdb on windows - Can't find python

    - by aldux
    I'm trying to install the module mySQLdb on a windows vista 64 (amd) machine. I've installed python on a different folder other than suggested by Python installer. When I try to install the .exe mySQLdb installer, it can't find python 2.5 and it halts the installation. Is there anyway to supply the installer with the correct python location (even thou the registry and path are right)?

    Read the article

  • Why does Python array moduel handle strings and lists differently?

    - by Casey
    I'm having trouble understanding the result of the following statements: >>> from array import array >>> array('L',[0xff,0xff,0xff,0xff]) array('L', [255L, 255L, 255L, 255L]) >>> from array import array >>> array('L','\xff\xff\xff\xff') Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: string length not a multiple of item size

    Read the article

  • call a server side python script from javascript

    - by alex
    how to call a server side python script from javascript. if test.py is the python script file in server, and if the parameter to be passed to python is another url , then how this can be executed from javascript, how the return string from python script is obtained to the javascript.

    Read the article

  • Mutable global variables don't get hide in python functions, right?

    - by aXqd
    Please see the following code: def good(): foo[0] = 9 # why this foo isn't local variable who hides the global one def bad(): foo = [9, 2, 3] # foo is local, who hides the global one for func in [good, bad]: foo = [1,2,3] print('Before "{}": {}'.format(func.__name__, foo)) func() print('After "{}": {}'.format(func.__name__, foo)) The result is as below: # python3 foo.py Before "good": [1, 2, 3] After "good": [9, 2, 3] Before "bad" : [1, 2, 3] After "bad" : [1, 2, 3]

    Read the article

  • python: html writer?

    - by Bin Chen
    With jquery it's very easy to insert some element inside another element using the selector technology, I am wondering if there is any python library that can do things similar with jquery, the reason is I want server side python program to produce the static pages, which needs to parse the html and insert something into it. Or other alternative, not in python language at all? EDIT: To be clear, I want to use python to write below program: h = html.parse('temp.html') h.find('#idnum').html('<b>my html generated</b>') h.close()

    Read the article

  • String replacement on a whole text file in Python 3.x?

    - by SkippyFire
    How can I replace a string with another string, within a given text file. Do I just loop through readline() and run the replacement while saving out to a new file? Or is there a better way? I'm thinking that I could read the whole thing into memory, but I'm looking for a more elegant solution... Thanks in advance

    Read the article

  • Where is python Language used

    - by Mirage
    I am a web developer and usually use php/JS/mysql. I have heard lot about python. I have no idea where is python used and why it is used. Just like php/asp/cold fusion/.net/ are used to build websites C, C++ , Java are used to build software or desktop apps Where does python stands from those langages WHich is the thing whic can be done by python but not with those common languages

    Read the article

  • Can I add Boost source+header files to my own (Open Source) project?

    - by rubenvb
    Is it allowed by the Boost License to just add the source code of the stuff I need to my project (accompanied by the license of course?). I couldn't find any "descriptive" confirmation. I would have seperate Include/boost and Source/boost directories for easy access. PS: Seeing as boost::filesystem is going into C++0x TR2, and lambda's are already in c++0x TR1, I don't see any reason to be juggling with C functions like realpath, getcwd and the like. They don't work well anyways...

    Read the article

  • Carrot (Python) [errno 10054] An existing connection was forcibly closed by the remote host

    - by Meditation
    Hi all, We are using Carrot in our Python project. I wrote a Python script acting as the consumer of the message queue. I invoked this Python script using command line shell in Windows 7 as python consumer.py However, after a while, the running session was aborted and the error is: [errno 10054] An existing connection was forcibly closed by the remote host The producer session is still running fine on the Linux server. Just wondering how can I fix this and have a long running consumer session on Windows Thanks in advance.

    Read the article

  • Have main thread wait for a boost thread complete a task (but not finish).

    - by JAKE6459
    I have found plenty on making one thread wait for another to finish executing before continuing, but that is not what I wanted to do. I am not very familiar with using any multi-threading apis but right now I'm trying to learn boost. My situation is that I am using my main thread (the starting one from int main()) to create an instance of a class that is in charge of interacting with the main GUI. A class function is then called that creates a boost thread which in turn creates the GUI and runs the message pump. The thing I want to do is when my main thread calls the classes member function to create the GUI, I don't want that function to return until I tell it to from the newly created thread. This way my main thread can't continue and call more functions from the GUI class that interact with the GUI thread until that thread has completed GUI creation and entered the message loop. I think I may be able to figure it out if it was multiple boost thread objects interacting with each other, but when it is the main thread (non-boost object) interacting with a boost thread object, I get lost. Eventually I want a loop in my main thread to call a class function (among other tasks) to check if the user as entered any new input into the GUI (buy any changes detected by the message loop being updated into a struct and changing a bool to tell the main thread in the class function a change has occurred). Any suggestions for any of this would be greatly appreciated. This is the member function called by the main thread. int ANNGUI::CreateGUI() { GUIMain = new Main(); GUIThread = new boost::thread(boost::bind(&Main::MainThreadFunc, GUIMain)); return 0; }; This is the boost thread starting function. void Main::MainThreadFunc() { ANNVariables = new GUIVariables; WndProc = new WindowProcedure; ANNWindowsClass = new WindowsClass(ANNVariables, WndProc); ANNWindow = new MainWindow(ANNVariables); GUIMessagePump = new MessagePump; ANNWindow-ShowWindows(); while(true) { GUIMessagePump-ProcessMessage(); } }; BTW, everything compiles fine and when I run it, it works I just put a sleep() in the main thread so I can play with the GUI a little.

    Read the article

  • Is there a way to accept '%' as part of input that works both in python 2.6 & 3.0?

    - by bug11
    In 2.6, if I needed to accept input that allowed a percent sign (such as "foo % bar"), I used raw_input() which worked as expected. In 3.0, input() accomplishes that same (with raw_input() having left the building). As an exercise, I'm hoping that I can have a backward-compatible version that will work with both 2.6 and 3.0. When I use input() in 2.6 and enter "foo % bar", the following error is returned: File "<string>", line 1, in <module> NameError: name "foo" is not defined ...which is expected. Anyway to to accomplish acceptance of input containing a percent sign that works in both 2.6 and 3.0? Thx.

    Read the article

  • boost.serialization and lazy initialization

    - by niXman
    i need to serialize directory tree. i have no trouble with this type: std::map< std::string, // string(path name) std::vector<std::string> // string array(file names in the path) > tree; but for the serialization the directory tree with the content i need other type: std::map< std::string, // string(path name) std::vector< // files array std::pair< std::string, // file name std::vector< // array of file pieces std::pair< // <<<<<<<<<<<<<<<<<<<<<< for this i need lazy initialization std::string, // piece buf boost::uint32_t // crc32 summ on piece > > > > > tree; how can i serialize the object of type "std::pair" in the moment of its serialization?

    Read the article

  • Boost.Program_options fixed number of tokens

    - by kloffy
    Boost.Program_options provides a facility to pass multiple tokens via command line arguments as follows: std::vector<int> nums; po::options_description desc("Allowed options"); desc.add_options() ("help", "Produce help message.") ("nums", po::value< std::vector<int> >(&nums)->multitoken(), "Numbers.") ; po::variables_map vm; po::store(po::parse_command_line(argc, argv, desc), vm); po::notify(vm); However, what is the preferred way of accepting only a fixed number of arguments? The only solution I could come is to manually assign values: int nums[2]; po::options_description desc("Allowed options"); desc.add_options() ("help", "Produce help message.") ("nums", "Numbers.") ; po::variables_map vm; po::store(po::parse_command_line(argc, argv, desc), vm); if (vm.count("nums")) { // Assign nums } This feels a bit clumsy. Is there a better solution?

    Read the article

< Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >