Re: [Tutor] Printing from python

2014-03-21 Thread Lee Harr
is there another way to print a PDF form python? My problem is a PDF which is printed well by evince, but not with lp,  even not out of python using os.system(lp some_options file.pdf) Later on I have to build the PDF in a python program (using reportlab)  and then print it, even from the

Re: [Tutor] Python Django

2014-01-10 Thread Lee Harr
I am very interested to hear your opinion on which version of Python to use in conjunction with Django. Currently, I am taking a class at Udemy and they recommend using Python 2.7 with Django 1.6. because both versions work well with each other. Over the last few months I got pretty much

Re: [Tutor] writing function changeColor

2012-07-18 Thread Lee Harr
I learned python so that if I were to put in 0.9, it'd decrease red by 10%. The way this function needs to be written, -0.1 decreases red by 10% It sounds like you have something like ... def f1(color, redchange=0, bluechange=0, greenchange=0):    # some code here to make the changes   

Re: [Tutor] Problem When Iterating Over Large Test Files

2012-07-18 Thread Lee Harr
  grep ^TTCTGTGAGTGATTTCCTGCAAGACAGGAATGTCAGT$ with no results How about: grep TTCTGTGAGTGATTTCCTGCAAGACAGGAATGTCAGT outfile Just in case there is some non-printing character in there... Beyond that ... my guess would be that you are either not readingthe file you think you are, or not

Re: [Tutor] How to interact with users on IRC using Python

2012-04-18 Thread Lee Harr
How do I create a small IRC program which can send and receive private messages from users? I created a multiplayer game that can create a standalone server like a MUD, or communicate over IRC, or both (I think) acting as a gateway between the two. It uses Twisted, which some find arcane,

Re: [Tutor] (de)serialization questions

2010-10-01 Thread Lee Harr
I have data about zip codes, street and city names (and perhaps later also of street numbers). I made a dictionary of the form {zipcode: (street, city)} One dictionary with all of the data? That does not seem like it will work. What happens when 2 addresses have the same zip code? You

Re: [Tutor] (de)serialization questions

2010-09-30 Thread Lee Harr
I have data about zip codes, street and city names (and perhaps later also of street numbers). I made a dictionary of the form {zipcode: (street, city)} One dictionary with all of the data? That does not seem like it will work. What happens when 2 addresses have the same zip code? Are

Re: [Tutor] Question about Dictionaries

2010-08-16 Thread Lee Harr
I know that I can look up the value for a particular key in a dictionary, but can I look up the key associated with a particular value? I am using bidict in one of my projects: http://pypi.python.org/pypi/bidict/0.1.1 It's probably a bit more complex than what I need, but the parts I am

Re: [Tutor] Scripting Blender

2010-08-11 Thread Lee Harr
Are there any Python modules to script Blender? For example, placing predefined objects into a new Blender project to create a 3D model. If you are using 2.5, I saw this posted on blendernation.com just today: http://blenderartists.org/forum/showthread.php?t=193908

Re: [Tutor] can i run the last saved input again

2010-07-24 Thread Lee Harr
hey this is a crazy question but i want to know it.. suppose i have this code a=raw_input(enter the string :) print a then i type python prog.py output: enter the string:hello hello now i want to ask is there's any way that python remembers the input i gave it to last time and

Re: [Tutor] Strange range and round behaviour

2010-06-07 Thread Lee Harr
Just out of curiosity does anyone know why you get a deprecation warning if you pass a float to range but if you use round, which returns a float, there is no warning? It has nothing to do with the round. It's just that the warning is only shown once: $ python Python 2.6.5 (r265:79063, Apr

Re: [Tutor] XML-RPC data transfers.

2006-12-29 Thread Lee Harr
http://www.velocityreviews.com/forums/t343990-xmlrpc-send-file.html Using this example I get error's about 'expected binary .read(), but got instance instead. I assume you are using this ... d = xmlrpclib.Binary(open(C:\\somefile.exe).read()) Are you using windows? I think you would need to

Re: [Tutor] Pygame mailing list info needed

2005-12-21 Thread Lee Harr
I subscribed to the pygame-users mailing list through [EMAIL PROTECTED], but I don't know where to send the mail too so that everybody can see it. Any suggestion on how to use that mailing list? http://www.google.com/search?q=pygame+mailing+list 2nd link ... Pygame maintains an active

Re: [Tutor] Python as Application (OT now)

2005-10-29 Thread Lee Harr
Sorry about misposting this here. I always mix up the tutor@ and edu-sig@ lists. I am just going to follow up two things that seem tutor related. If this seems interesting, you may want to join the edu-sig list for more... More frightening to me than the ubiquitous use of MS Office is the

Re: [Tutor] Making a character jump with pygame

2005-10-07 Thread Lee Harr
I've edited the aliens.py example to make my character just move back and forth. However I can't make him jump! It is not really clear to me from your code where you expect the character to jump. I do not see the word jump anywhere. I do see the word bounce and one reference to the top of

Re: [Tutor] Pager in Python?

2005-07-25 Thread Lee Harr
Is there a command like more(1) or less(1) in python to display the output of a command (e.g. dir()) one page at a time? How are you using dir() ? Is it in the DOS Window ? One option would be to just get a better console. I am using Python 2.4 on RedHat Linux 8.0. In xterm

Re: [Tutor] newbie help audio IO + python

2005-07-19 Thread Lee Harr
I've been looking at lots of sites and checked out the docs, but can't find the info I am looking for to be able to detect audio input from my sound card. You do not say if you need to do this in a cross-platform way. I thought maybe SDL (which is wrapped by pygame) might help, but this is

Re: [Tutor] Pager in Python?

2005-07-19 Thread Lee Harr
Is there a command like more(1) or less(1) in python to display the output of a command (e.g. dir()) one page at a time? How are you using dir() ? Is it in the DOS Window ? One option would be to just get a better console. You also might want to look at something like ipython. Using that,

Re: [Tutor] remove from python

2005-06-08 Thread Lee Harr
how can i get my email address removed, I'm receiving way too many emails You have a few options. You may want to see if just turning the Tutor mailing list setting to Digest Mode might help. You can do this through: http://mail.python.org/mailman/options/[EMAIL PROTECTED] Personally, I

Re: [Tutor] Detecting my own IP address?

2005-06-05 Thread Lee Harr
At present, the only thing I can think of is to redirect the output of 'ifconfig' into a temporary file, then read it back in and use Python and regular expressions to try and extract the IP info from that. That is basically how I do it. See here:

Re: [Tutor] Building an SQL query

2005-06-03 Thread Lee Harr
data = {} data['ids_to_process'] = ['1','2','3','5','7','11'] query = ''' UPDATE my_table SET state = 'processed' WHERE id IN ARRAY%(ids_to_process)s ''' db.execute(query, data) Sorry. It should look like ... query = ''' UPDATE my_table SET state = 'processed'

Re: [Tutor] Postgresql+Python -tutorial?

2005-06-03 Thread Lee Harr
I've been using MySQL up this day, but would like to convert my program to use Postgresql. I'm curious. Why? Is there some advantage to Postgres over MySql? Postgres behaves a lot like Python in that it'll die early rather than try to guess at what the user means. Postgres handles bad data

Re: [Tutor] Building an SQL query

2005-06-02 Thread Lee Harr
data = {} data['start_date'] = '2005-6-2' data['last_name'] = 'Johnson' query = ''' SELECT * FROM my_table WHERE date = '%(start_date)s' AND last_name = '%(last_name)s' ''' % data results = my_database.Execute(query) First up. This is a bad idea. It may be ok now, as long

Re: [Tutor] Eclipse and Member Function Availability

2005-05-27 Thread Lee Harr
using autocomplete feature within Eclipse Are you using pydev? http://pydev.sourceforge.net/ Their website says: New Release: 0.9.3!! Wohooo!! Code completion Rules! Check it out! So apparently this is something they are actively working on. You may have an old version, or you may have found

Re: [Tutor] Python won't play wav file

2005-05-24 Thread Lee Harr
I can't get: import wave as w ... to play a .wav music file. I tried w.play() but got an error that module has no attribute 'play'. What do I use to get it to play? Strangely... I do not believe the wave module is meant to actually _play_ a wav file. It looks to me like it is only intended

Re: [Tutor] I know you will hate this but...

2005-05-18 Thread Lee Harr
Inconsistent indentation styles are very annoying in other languages, but a fatal problem in Python. But there is no way to enforce standard settings. When new versions are installed or someone just makes a mistake the settings might change and you won't know until it's too late...possibly weeks

Re: [Tutor] help: space formatting for multiplication table

2005-05-14 Thread Lee Harr
The idea is to print out a multiplication table on the command line with numbers lining up in the ones column. I want to eventually emulate programs like top with their spacing. But this code is mostly for my amusement. How would you make this work? Try print string formatting using % print

Re: [Tutor] Linux variable to Python

2005-05-13 Thread Lee Harr
import os os.system(fec=cam`date +%Y%m%d%H%M%S`.jpg) 0 os.system(echo $fec) 0 os.system(mv hola.txt grabacion/$fec) 0 Each system() call gets a fresh shell, and a fresh env ... import os os.environ['foo'] = 'bar' os.system('echo $foo') bar 0 os.system('foo=zzz') 0 os.system('echo $foo') bar 0

Re: [Tutor] Web Calendar written in Python

2005-05-04 Thread Lee Harr
Does anyone know of a Web Calendar written in Python? I believe that SchoolBell is using Zope 3 ... http://www.schooltool.org/schoolbell _ Express yourself instantly with MSN Messenger! Download today it's FREE!

[Tutor] Re: newbie intro to pickle

2005-04-16 Thread Lee Harr
Pickling simply converts an object to a string (unpickling does the opposite, convert a string to an object). The dump() function writes the generated string directly to a file, but you can use the dumps() function to get the generated string as such and do something else with it (e.g. put it

[Tutor] Re: PyGTk and Glade help

2005-04-14 Thread Lee Harr
We are developing a CBT based Free Software for our social activities. We are using PyGTK alongwith Glade. We want to print a document through Printer and also we want to provide Sound support in our software. Has somebody worked on PyGTK or Python? We are not getting the PyGTK API's for sound and

[Tutor] Re: problems with doctest: apparent interferance between tests (LONG)

2005-04-10 Thread Lee Harr
I have apparent interference between doctests embedded in the docstrings of different methods, and this interference also appears to be influenced by seemingly irrelevant things such as whether the module has a (non-doctest-containing) docstring or not. I, and what hair I've not yet torn out,

[Tutor] Re: How to create multi disks zip file

2005-04-08 Thread Lee Harr
I'm a newbie. My friend asked me for a help. He wanted to backup his files into multi disks zip file. Is there any possibilities for me to help him by using python? Err... you probably could, but why reinvent the wheel? WinZip? winzip is not free, and I always found it terribly annoying.

[Tutor] Re: Script (Python) for Zope

2005-04-05 Thread Lee Harr
Hello, I am looking for a Python-script for Zope which counts the objects (files) in the current folder and all its subfolders, but I don't know how to implement this script. Can somebody help me, please? Or ist there a newsgroup/mailing list which can help me to find a solution for this problem?

[Tutor] Re: Dates and databases, and blobs and Python.

2005-03-26 Thread Lee Harr
Just a quick query. I want to store dates and work with them in my SQLite database. There's no specific need for any calculations to done on one side or another (i.e. it's a single user database). I googled how to work with dates in SQL, and I got one like this - SELECT * FROM totp WHERE wk

[Tutor] Re: communication between java and python?

2005-01-13 Thread Lee Harr
I'm trying to communicate between Python and Java and using os.popen(). But thing dont work...The Java program reads strings from stdin and the python program just writes to stdout. -first call the java program using: handlers = os.popen('java StdIn) -then:

[Tutor] Re: Is there a better way to do this?

2004-12-22 Thread Lee Harr
class greating: # I think the word you are looking for is # greeting def __init__(self): self.OK = False self.lowValue = 1 self.highValue = 6 def opening(self): print Please choose from the following options. 1) - Normal Unit test with static

[Tutor] Re: listing all combinations of elements of a list

2004-12-12 Thread Lee Harr
Is there a module containing a function for listing the unique k-element subsets of an n-item list? I have written some code (right now I only need it for 2 element subsets): Apparently not, but maybe this will help: http://www.google.com/search?q=python+recipe+list+combinations

[Tutor] Re: Pygame problems

2004-12-11 Thread Lee Harr
I am not sure if this is the right place, apologies if not. http://pygame.org/ http://pygame.org/info.shtml#maillist Now how can I get this to be on more than one line and bigger (for my simple game I need a much more detailed explanation). http://mu.arete.cc/pcr/