Search Results

Search found 13693 results on 548 pages for 'python metaprogramming'.

Page 95/548 | < Previous Page | 91 92 93 94 95 96 97 98 99 100 101 102  | Next Page >

  • Catching and outputting stderr at the same time with python's subprocess

    - by Mediocre Gopher
    (Using python 3.2 currently) I need to be able to: Run a command using subprocess Both stdout/stderr of that command need be printed to the terminal in real-time (it doesn't matter if they both come out on stdout or stderr or whatever At the same time, I need a way to know if the command printed anything to stderr (and preferably what it printed). I've played around with subprocess pipes as well as doing strange pipe redirects in bash, as well as using tee, but as of yet haven't found anything that would work. Is this something that's possible?

    Read the article

  • Python UTF-8 can't decode byte on 32-bit machine

    - by jsh617
    it works fine on 64 bit machines but for some reason will not work on python 2.4.3 on a 32-bit instance. i get the error 'utf8' codec can't decode bytes in position 76-79: invalid data for the code try: str(sourceresult.sourcename).encode('utf8','replace') except: raise Exception( repr(sourceresult.sourcename ) ) it returns 'kazamidori blog\xf9' i have modified my site.py file to make UTF8 the default encoding, but still doesnt seem to be working.

    Read the article

  • Executing JavaScript with Python without X.

    - by Thomas
    I want to parse a html-page that unfortunately requires JavaScript to show any content. In order to do so I use a small python-script that pulls the html-code of the page, but after that I have to execute the JavaScript in a DOM-context which seems pretty hard. To make it even harder I want to use it in a server environment that has no X11-server. Note: I already read about http://code.google.com/p/pywebkitgtk/ but it seems to need a X-server.

    Read the article

  • How to implement a Mutex in Python when using Gtk with PyGTK

    - by Julian
    Hi, I have an application that starts several threads using gobject.timeout_add(delay, function) Now in my function I want to test and set on some variable, e.g. def function(self): if flag == True: flag = False doSomething() Now to make this threadsafe, I would have to lock the function using some mutex lock. Is this possible with Gtk? Or can I use the Python Lock objects from threading?

    Read the article

  • Python interpreter with Linux Screen

    - by Unknown
    I was working with Python with a Linux terminal screen. When I typed: help(somefunction) It printed the appropriate output, but then my screen was stuck, and at the bottom of the terminal was "(end)". How do I get unstuck? Thanks in advance.

    Read the article

  • How to write a large number of nested records in JSON with Python

    - by jamesmcm
    I want to produce a JSON file, containing some initial parameters and then records of data like this: { "measurement" : 15000, "imi" : 0.5, "times" : 30, "recalibrate" : false, { "colorlist" : [234, 431, 134] "speclist" : [0.34, 0.42, 0.45, 0.34, 0.78] } { "colorlist" : [214, 451, 114] "speclist" : [0.44, 0.32, 0.45, 0.37, 0.53] } ... } How can this be achieved using the Python json module? The data records cannot be added by hand as there are very many.

    Read the article

  • question about python sched schedular.

    - by samy
    I have read about python sched (task schedular), it works like a cron. but I have a question : lets say if i schedule a function to ryn after every 2 hours and in the mean time my system gets shut down, then I again restart the system...did the schedular automatically starts and will run the function after 2 hours? or i have to start that again after shutting down the system? did sched work like a deamon?

    Read the article

  • Exposing members or make them private in Python?

    - by deamon
    Is there a general convention about exposing members in Python classes? I know that this is a case of "it depends", but maybe there is a rule of thumb. Private member: class Node: def __init__(self): self.__childs = [] def add_childs(self, *args): self.__childs += args node = Node() node.add_childs("one", "two") Public member: class Node2: def __init__(self): self.childs = [] node2 = Node2() node2.childs += "one", "two"

    Read the article

  • How are python pages coded and what can the language be compared to? [closed]

    - by avon_verma
    I have a few questions about python I've seen many pages like these on Google http://mail.google.com/support/bin/answer.py?answer=6583 https://www.google.com/adsense/support/bin/topic.py?topic=13488 ...that have .py extensions. 1: Are pages like these built on pure python code, but printing out html like print "<div etc..." or like the typical asp,jsp,php type of pages with html pages and embedded python code like: <html> <% some python code %> </html> 2: What is python mainly used for making? windows apps or web or .. ? 3: Are ruby and perl also similar to python?

    Read the article

  • Python: saving and loading a class definition

    - by Peterstone
    Hi! I am interested in saving and load objects using the pickle module as you can read in a question I asked before: Python: Errors saving and loading objects with pickle module Someone commment: 1, In an other way: the error is raise because pickle wanted to load an instance of the class Fruits and search for the class definition where it was defined, but it didn't find it so it raise the error Now I want to save and load a class definition in order to solve the problem I describe in the question mentioned before. Thank you so much!

    Read the article

  • How can I unshorten a URL using python?

    - by Andrew
    I want to be able to take a shortened or non-shortened URL and return its un-shortened form. How can I make a python program to do this? Additional Clarification: Case 1: shortened -- unshortened Case 2: unshortened -- unshortened e.g. bit.ly/silly in the input array should be google.com in the output array e.g. google.com in the input array should be google.com in the output array Thanks for the help!

    Read the article

  • CAC Client Application Authentication in Python

    - by Präriewolf
    I am building a python application to pull data from a website. The application has to authenticate(HTTPS/SSL) with a CAC card and pin in order to make requests. Am I correct in my assumptions that you can't retrieve the private key from a CAC card, and am therefore stuck using a PKCS #11 Wrapper like PyKCS? Any tips or resources for going about this?

    Read the article

  • Time Calculation in Python

    - by user343934
    Hi everyone, I have two python cgi pages (index, display), what i need to do is calculate time frame between the execution. Work flow: Index.py (submit) After submit it redirect to display.py page display.py page has got class with execute(),display() &init_main() functions In init_main() i have created class object which access to above functions I need to calculate time interval between the submit (index.py) to execute() end, so i can show user how much time does different weighted file takes on real time. Hoping to see your suggestions Thanks

    Read the article

  • Running Subprocess from Python

    - by Rohit
    I want to run a cmd exe using a python script. I have the following code: def run_command(command): p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) return p.communicate() then i use: run_command(r"C:\Users\user\Desktop\application\uploader.exe") this returns the option menu where i need to specify additional parameter for the cmd exe to run. So i pass additional parameters for the cmd exe to run. How do i accomplish this. I've looked at subprocess.communicate but i was unable to understand it

    Read the article

  • Python shortcuts

    - by lyrae
    Python is filled with little neat shortcuts. For example: self.data = map(lambda x: list(x), data) and (although not so pretty) tuple(t[0] for t in self.result if t[0] != 'mysql' and t[0] != 'information_schema') among countless others. In the irc channel, they said "too many to know them all". I think we should list some here, as i love using these shortcuts to shorten & refctor my code. I'm sure this would benefit many.

    Read the article

  • Python inter-computer communication.

    - by matt1024
    This whole topic is way out of my depth, so forgive my imprecise question, but I have two computers both connected to one LAN. What I want is to be able to communicate one string between the two, by running a python script on the first (the host) where the string will originate, and a second on the client computer to retrieve the string. What is the most efficient way for an inexperienced programmer like me to achieve this?

    Read the article

  • Constructing an if statement from the client data in python

    - by Vishal
    Hi, I need to construct an if statement from the data coming from the client as below: conditions: condition1, condition2, condition3, condition4 logical operators: lo1, lo2, lo3 (Possible values: "and" "or") Eg. if condition1 lo1 condition2 lo3 condition4: # Do something I can think of eval/exec but not sure how safe they are! Any better approach or alternative? Appreciate your responses :) PS: Client-side: Flex, Server-side: Python, over internet Thanks

    Read the article

  • Python process will not exit

    - by oneself
    Hi, I'm use nosetests to run some tests. However, after the tests have finished running, the nosetests process just sits there, and will not exit. Is there anyway to diagnose this? Does Python have a facility similar to sending Java a kill -QUIT which will print a stack trace?

    Read the article

< Previous Page | 91 92 93 94 95 96 97 98 99 100 101 102  | Next Page >