I usually work on a Linux system, but I have a situation where I need to write a client app that would run on windows as a service. Can someone help me or direct, on how to build a system tray app (for example like dropbox) for the windows environment, which gets started on OS startup and the icon sits
Capturing print output from shared library called from python with ctypes module
I am working with a shared library that is being called through the ctypes module. I would like to redirect the stdout associated with this module to a variable or a file that I can access in my program. However ctypes uses a separate stdout from sys.stdout. I’ll demonstrate the problem I am having with libc. If anyone is copying
Python Paramiko – Run command
I’m try to run this script: The question is: how can I put the variables y,m,d into the variable command ? Answer Python has lots of ways to perform string formatting. One of the simplest is to simply concatenate the parts of your string together:
How to create a subclass in python that is inherited from turtle Module
So, i’m trying to learn python and every time i post a question here it feels like giving in… I’m trying to make my own class of turtle.Turtle. Gives the Traceback: AttributeError: ‘TurtleGTX’ object has no attribute ‘_position’. Which I then learn is a “private vairable” which according to the offical python tutorial i can mangle/override in my subclass TurtleGTX.
Remove duplicate dict in list in Python
I have a list of dicts, and I’d like to remove the dicts with identical key and value pairs. For this list: [{‘a’: 123}, {‘b’: 123}, {‘a’: 123}] I’d like to return this: [{‘a’: 123}, {‘b’: 123}] Another example: For this list: [{‘a’: 123, ‘b’: 1234}, {‘a’: 3222, ‘b’: 1234}, {‘a’: 123, ‘b’: 1234}] I’d like to return this: [{‘a’:
Recommendations for Low Discrepancy (e.g. Sobol) quasi-random sequences in Python/SciPy?
I would like to use a quasi-random sequence, specifically Sobol, within a SciPy based simulation. Any recommendations on existing, efficient packages? Answer I would use OpenTURNS, which provides several low discrepancy sequences: Faure sequence, Halton sequence, Reverse Halton sequence, Haselgrove sequence, Sobol sequence. Moreover, the sequence can be generated so that the marginals have arbitrary distribution. This is done with
Can’t import my own modules in Python
I’m having a hard time understanding how module importing works in Python (I’ve never done it in any other language before either). Let’s say I have: Now I’m trying to get something like this: However, I’m definitely doing something wrong as Python can’t see that myapp is a module: Answer In your particular case it looks like you’re trying to
Orthogonal regression fitting in scipy least squares method
The leastsq method in scipy lib fits a curve to some data. And this method implies that in this data Y values depends on some X argument. And calculates the minimal distance between curve and the data point in the Y axis (dy) But what if I need to calculate minimal distance in both axes (dy and dx) Is there
How do I generate permutations of length LEN given a list of N Items?
Note: I’m working in python on this. For example, given a list: I want to generate a list of lists with all possible 3-item combinations: The permutations should not use the same item twice in a permutation, but the order is important and represents distinct permutations that should be included, e.g., Should both be included. “3” is the magic length
Reply to Tweet with Tweepy – Python
I can’t seem to get tweepy to work with replying to a specific tweet: The api says it takes optional parameters and in_reply_to_status_id is the first, but it seems to be ignoring it altogether. This script will post an updated status, but it does not link it as a reply to the tweetId that I’m passing. API for reference: http://code.google.com/p/tweepy/wiki/APIReference#update_status