I have a program (temptrack) where I need to download weather data every x minutes for x amount of hours. I have figured out how to download every x minutes using time.sleep(x*60), but I have no clue how to repeat this process for a certain amount of hours.
UPDATE:
Thank you to everyone who posted a solution.
I marked the example using ...
The title explains it well. I have set up Notepad++ to open the Python script in the command prompt when I press F8 but all Swedish characters looks messed up when opening in CMD but perfectly fine in e.g IDLE.
This simple example code:
#!/usr/bin/env python
#-*- coding: UTF-8 -*-
print "åäö"
Looks like this.
As you can see the outp...
I am writing a simple Python script with no GUI. I want to be able to drag and drop multiple files onto my python script and have access to their absolute paths inside of the script. How do I do this in Mac, Linux, and windows? For times sake, just Mac will be fine for now.
I've googled this question and only found one related one but i...
I'm creating a web application on Google AppEngine where I want the user to be notified a quickly as possible after certain events occour. The problem is similar to say a chat server in that I need something happening on one connection (someone is writing a message in a chat room) to propagate to a number of other connections (other peop...
How can I add a newline to a plot's label (e.g. xlabel or ylabel) in Matplotlib? For example,
plt.bar([1, 2], [4, 5])
plt.xlabel("My x label")
plt.ylabel(r"My long label with $\Sigma_{C}$ math \n continues here")
Ideally i'd like the y-labeled to be centered too. Is there a way to do this? It's important that the label have both t...
I want to check the central limit with dices. Roll D dices. Sum the results. Repeat the same thing for N times. Change D and repeat.
There's no need to store random values so I want to use only generators. The problem is that the generators are consumed; I can't reuse them many times. Now my code uses explicit for and I don't like it.
...
I'm using the socket.makefile method to create a file-like object on a UDP socket for the purposes of reading. When I receive a UDP packet, I can read the entire contents of the packet all at once by using the read method, but if I try to split it up into multiple reads, my program hangs.
Here's a program which demonstrates this proble...
I have a webapp that lists all of my artists, albums and songs when the appropriate link is clicked. I make extensive use of generic views (object_list/detail) and named urls but I am coming across an annoyance. I have three templates that pretty much output the exact same html that look just like this:
{% extends "base.html" %}
{% bl...
Hi,
Using Django 1.1, I am trying to select the maximum value from a varchar column (in MySQL.) The data stored in the column looks like:
9001
9002
9017
9624
10104
11823
(In reality, the numbers are much bigger than this.)
This worked until the numbers incremented above 10000:
Feedback.objects.filter(est__pk=est_id).aggregate(sid...
I'm running fabric (Django deployment to apache) and everything seems to work fine until I get to the task for installing the site:
def install_site():
"Add the virtualhost file to apache"
require('release', provided_by=[deploy, setup])
sudo('cd %(path)/releases/%(release)/%(release); cp %(project_name)/%(virtualhost_path)/%...
i have a python script which keeps crashing on:
subprocess.call(["pdftotext", pdf_filename])
the error being:
OSError: [Errno 2] No such file or directory
the absolute path to the filename (which i am storing in a log file as i debug) is fine; on the command line, if i type pdftotext <pdf_filename_goes_here> it works for any of the...
Hey all,
As the title says, I'm grabbing the cursor location within a motion triggered event handler in Tkinter. I'd like to update an existing label widget with the location, however I cannot for the life of me figure out how to edit the label's text field (or any external object for that matter) within the event handler. From what I u...
I'm looking to install an online text editor on my server, that I can link to svn.
I would like to have some form of syntax highlighting, keyboard shortcuts, and perhaps some text complete.
Languages, python, php, sql, and C++ are a minimum ...
any suggestions?
...
Tricky to explain with words so I'll use a picture.
A: row 0, column 0
B: row 0, column 1
C: row 1, column 0, span 2
...
How can I get python to work with simplified Chinese text input either as strings or raw input?
...
I'm currently working on sprite sheet tool in python that exports the organization into an xml document but I've run into some problems trying to animate a preview. I'm not quite sure how to time the frame rate with python. For example, assuming I have all of my appropriate frame data and drawing functions, how would I go about coding th...
Is it possible to write custom collation functions with indexes in SQLAlchemy? SQLite for example allows specifying the sorting function at a C level as sqlite3_create_collation().
An implementation of some of the Unicode collation algorithm has been provided by James Tauber here, which for example sorts all the "a"'s close together wh...
I have a django project I keep on github. It worked perfectly fine on my laptop. I downloaded it on my desktop and tried to "python manage.py runserver" or even "python manage.py shell"
I get a
Error: No module named messages
No other messages, no stack trace, nothing..Anyone have any idea whats going on?
Thanks.
...
I'm looking for a way to programatically control a browser on a Mac (i.e. not IE) using Python.
The actions I need include following links, checking if elements exist in a page, and submitting forms.
Which solution would you recommend?
Thanks!
...
Any ideas?
In [1]: from selenium.firefox.webdriver import WebDriver
In [2]: d=WebDriver()
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
/usr/local/selenium-read-only/<ipython console> in <module>()
/opt/local/Library/Frameworks/P...