Search Results

Search found 27205 results on 1089 pages for 'python imaging library'.

Page 32/1089 | < Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >

  • Learning python in one weekend

    - by permalac
    Hello, I'm planing to learn python this weekend. I have some programing skills and should not be difficult if I take the good path. I'm a sysadmin and I've been looking at python scripts since long ago, but now I would like to make python my scripting language, so I'll do the effort and next monday I will start using it. Any advice on how to trace my own path to good python skills? thanks. PS: I will use vim, ypython and http://diveintopython.org

    Read the article

  • 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

  • SWI-Prolog Semantic Web Library and Python Interface

    - by John Peter Thompson Garcés
    I want to write a Python web application that queries RDF triples using Prolog. I found pyswip for interfacing Python with SWI-Prolog, and I am currently looking into SWI-Prolog's RDF capabilities. I am wondering if anyone has tried this before--and if anyone has: what did your setup look like? How do you get pyswip to work with the SWI-Prolog semantic web library? Or is there another Python-Prolog interface that makes this easier?

    Read the article

  • Building a ctypes-"based" C library with distutils

    - by Robie Basak
    Following this recommendation, I have written a native C extension library to optimise part of a Python module via ctypes. I chose ctypes over writing a CPython-native library because it was quicker and easier (just a few functions with all tight loops inside). I've now hit a snag. If I want my work to be easily installable using distutils using python setup.py install, then distutils needs to be able to build my shared library and install it (presumably into /usr/lib/myproject). However, this not a Python extension module, and so as far as I can tell, distutils cannot do this. I've found a few references to people other people with this problem: Someone on numpy-discussion with a hack back in 2006. Somebody asking on distutils-sig and not getting an answer. Somebody asking on the main python list and being pointed to the innards of an existing project. I am aware that I can do something native and not use distutils for the shared library, or indeed use my distribution's packaging system. My concern is that this will limit usability as not everyone will be able to install it easily. So my question is: what is the current best way of distributing a shared library with distutils that will be used by ctypes but otherwise is OS-native and not a Python extension module? Feel free to answer with one of the hacks linked to above if you can expand on it and justify why that is the best way. If there is nothing better, at least all the information will be in one place.

    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

  • Any AOP support library for Python ?

    - by edomaur
    I am trying to use some AOP in my Python programming, but I do not have any experience of the various libs that exists. So my question is : What AOP support exists for Python, and what are the advantages of the differents libraries between them ? Edit : I've found some, but I don't know how they compare : Aspyct Lightweight AOP for Python Edit2 : In which context will I use this ? I have two applications, written in Python, which have typically methods which compute taxes and other money things. I'd like to be able to write a "skeleton" of a functionnality, and customize it at runtime, for example changing the way local taxes are applied (by country, or state, or city, etc.) without having to overload the full stack.

    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

  • 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

  • Web hooks in Python: Any particular library?

    - by Gopal
    Hi .. somewhat of a noob here to web programming. Just getting my feet wet in python. I wanted to implement web hooks in python. Both at server end and client end. Is there any particular library for implementing web hooks? Or does django or twisted python handle this?

    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

  • 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

  • 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

  • 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

< Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >