stdiodemo and command history
Hello again to all, While playing and extending stdiodemo.py, a came up with a thought of adding command line history. Is this possible? Any hints? Thanks Antonis K. ...
Hello again to all, While playing and extending stdiodemo.py, a came up with a thought of adding command line history. Is this possible? Any hints? Thanks Antonis K. ...
Question: Is it possible to use a variable as your table name w/o having to use string constructors to do so? Info: I'm working on a project right now that catalogs data from a star simulation of mine. To do so I'm loading all the data into a sqlite database. It's working pretty well, but I've decided to add a lot more flexibility, ...
I have a directory with a large number of files (~1mil). I need to choose a random file from this directory. Since there are so many files, os.listdir naturally takes an eternity to finish. Is there a way I can circumvent this problem? Maybe somehow get to know the number of files in the directory (without listing it) and choose the 'n'...
I have a form along the lines of: class aForm(forms.Form): input1 = forms.CharField() input2 = forms.CharField() input3 = forms.CharField() What I'm hoping to do is add an additional input3 to the form when the user clicks an "add another input3". I've read a bunch of ways that let me add new forms using formsets, but I don't w...
Hi All, My application has a xml based configuration. It has also a xsd file. Before my application starts, xmllint will check the configuration against the xsd file. With the growth of my application, the configuration structure has changed a bit. Now I have to face this problem: When I provide a new version of my application to cust...
Thanks in advance. Using Excel in the data tab there is a filter option. I wish to implement that into a program I have been working on. It may be as simple as 1 line. If you know anything or if it is not possible in this version/programming language please let me know Thanks! For more information: I want to use the sort option to app...
Hi, I have a Python script which accepts a XML file as input and then processes it and creates another file. Now the way I have to run this program in terminal (mac) is: ttx myfile.xml And it does the job. Now I am trying to install this program on a web server. I have all the necessary files installed as Modu...
I'm using modelform in django to insert and update objects in my database, but when I try to update I cannot see the primary key/id of the object being updated: My model: class Category(models.Model): name = models.CharField(max_length=20, db_index = True) and my form: class CategoryForm(ModelForm): class Meta: model...
I need help creating a self extracting zip file that does not display anything. I just need it to extract the files to a given place in the background. Everything I have found displays a dialog, but I need it to just run in the background. ...
Suppose I have a 2d sparse array. In my real usecase both the number of rows and columns are much bigger (say 20000 and 50000) hence it cannot fit in memory when a dense representation is used: >>> import numpy as np >>> import scipy.sparse as ssp >>> a = ssp.lil_matrix((5, 3)) >>> a[1, 2] = -1 >>> a[4, 1] = 2 >>> a.todense() matrix([[...
Hi, I have function defined this way: def f1 (a, b, c = None, d = None): ..... How do I check that a, b are not equal to some value. E.g. I want to check they are not empty strings like, "" or " " Thinking about something like. arguments = locals() for item in arguments: check_attribute(item, arguments[item]) And then che...
Using PyClips, I'm trying to build rules in Clips that dynamically retrieve data from the Python interpreter. To do this, I register an external function as outlined in the manual. The code below is a toy example of the problem. I'm doing this because I have an application with a large corpus of data, in the form of a SQL database, whic...
Hello! I have a models in different files (blog/models.py, forum/models.py, article/models.py). In each of this files I have defined model classes with application prefix (BlobPost, BlogTag, ForumPost, ForumThread, Article, ArticleCategory). Also I have appliation - comment, for adding comment attached to any model object. For example,...
I'm quite new to python, so I'm doing my usual of going through Project Euler to work out the logical kinks in my head. Basically, I need the largest list size possible, ie range(1,n), without overflowing. Any ideas? ...
Hi, Whats wrong in this code? Here is my HTML: <html><body> <form action="iindex.py" method="POST" enctype="multipart/form-data"> <p>File: <input type="file" name="ssfilename"></p> <p><input type="submit" value="Upload" name="submit"></p> </form> </body></html> This is my Python script: #! /usr/bin/env python import os, sys; from mo...
Hi there, I'm using the execnet package to allow communication between Python scripts interpreted by different Python interpreters. The following code (test_execnet.py): import execnet for python_version in ('python', 'python3'): try: gw = execnet.makegateway("popen//python="+python_version) ch = gw....
We've got an XML-RPC server (implemented in python), and I'm trying to write a simple javascript app to send calls to it. Whatever library I make I seem to always get the error: Unsupported method ('OPTIONS') It's fair to say I don't understand the underlying protocols for XML-RPC and HTTP as well as I should. But what I do know is th...
I have a large several hudred thousand lines text file. I have to extract 30,000 specific lines that are all in the text file in random spots. This is the program I have to extract one line at a time: big_file = open('C:\\gbigfile.txt', 'r') small_file3 = open('C:\\small_file3.txt', 'w') for line in big_file: if 'S0414' in line: ...
I have used list_editable setting to make several fields editable on my model in the admin panel. The problem is, that when I edit the values and hit Enter, the browser behaves as if I clicked Go button next to actions drop-down list. I get the javascript popup warning: You have unsaved changes on individual editable fields. If you ru...
I have an array a=[1,2,3,4,5,6,7,8,9] and I want to find the indices of the element s that meet two conditions i.e. a>3 and a<8 ans=[3,4,5,6] a[ans]=[4,5,6,7] I can use numpy.nonzero(a>3) or numpy.nonzero(a<8) but not numpy.nonzero(a>3 and a<8) which gives the error: ValueError: The truth value of an array with more than one eleme...