Re: [Tutor] using easy_install to download eggs

2009-10-05 Thread Tim Michelsen
Hi, thanks for the hint. > pip (http://pypi.python.org/pypi/pip/) is a drop-in replacement for the > easy_install tool and can do that. > > Just run easy_install pip and set an environment variable > PIP_DOWNLOAD_CACHE to the path you want pip to store the files. Note > that the cache won't work

[Tutor] using easy_install to download eggs

2009-10-04 Thread Tim Michelsen
Hello, I would like to use easy_install to cache packages registered at PyPi locally. How can I do this for packages? I tried the hints from: http://peak.telecommunity.com/DevCenter/EasyInstall#installing-on-un-networked-machines It worked for some packages. But for others, the command easy_ins

Re: [Tutor] how to reference a function itself when accessing its private functions?

2009-05-05 Thread Tim Michelsen
Thanks a lot! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] how to reference a function itself when accessing its private functions?

2009-05-04 Thread Tim Michelsen
Dear Tutors and fellow pythonistas, I would like to get access to the private methods of my function. For instance: Who can I reference the docstring of a function within the function itself? Please have a look at the code below and assist me. Thanks and regards, Timmie CODE ### s = 'hel

Re: [Tutor] Webpy vs Django

2009-04-20 Thread Tim Michelsen
I can recommend you web2py: http://www.web2py.com/ It has been designed for didactical needs and has a low learning curve. Look at the manual extarct for an idea: Free manual chapters - http://mdp.cti.depaul.edu/examples/static/web2py_manual_cut.pdf or check the docs: http://www.web2py.com/ex

[Tutor] creating a list of all imported modules

2009-03-09 Thread Tim Michelsen
Hello, how do I create a list of all modules imported by my module/script? I am looking for something like %who in Ipython. Thanks for your help in advance. Regards, Timmie ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/li

Re: [Tutor] Difference in minutes between two time stamps

2009-03-03 Thread Tim Michelsen
import datetime s = '09:35:23' datetime.datetime.strptime(s, '%H:%M:%S') datetime.datetime(1900, 1, 1, 9, 35, 23) Can you figure out how to proceed from there? In case she doesn't know: import datetime as dt start="09:35:23" end="10:23:00" start_dt = dt.datetime.strptime(start, '%H:%

Re: [Tutor] Difference in minutes between two time stamps

2009-03-03 Thread Tim Michelsen
import datetime s = '09:35:23' datetime.datetime.strptime(s, '%H:%M:%S') datetime.datetime(1900, 1, 1, 9, 35, 23) Can you figure out how to proceed from there? In case she doesn't know: import datetime as dt start="09:35:23" end="10:23:00" start_dt = dt.datetime.strptime(start, '%H:%M:

[Tutor] using windows wide proxy settings

2008-12-03 Thread Tim Michelsen
Hello, is there any possibility in python to retrieve the system wide internet connection settings? I would like to access the proxy settings stored in Internet Explorer -> Extras -> Options -> Connection -> LAN settings. This would later be used by urllib. My aim is not to bother the user wi

Re: [Tutor] import data (txt/csv) into list/array and manipulation

2008-11-10 Thread Tim Michelsen
filetype(2) The other file contains signal data in three columns, column one is a unique identifier type int, and the other two columns contain two type int values (genomic location reference values) ** import this as array/list I want to map the location of filetype(2) with respect to filety

Re: [Tutor] Python to exe--how much work?

2008-06-26 Thread Tim Michelsen
> I've had some success generati ng .exe files using pyinstaller for a few simple python programs i've written (less than 100 lines of code, that just use the os module). How much harder will this be for longer code with more modules imported? you may also try GUI2exe http://xoomer.alice.it/i

Re: [Tutor] converting all files in a directory with subprocess

2008-05-19 Thread Tim Michelsen
Hello, just for the records: below is some code that works ### convert all t2t docs in a directory. #!/usr/bin/env python # -*- coding: utf-8 -*- import os import subprocess import fnmatch documentation_directory = './doc/' for file in os.listdir(documentation_directory): if fnmatch.fnmat

Re: [Tutor] Open a directory in the default file manager

2008-05-19 Thread Tim Michelsen
Hi! > is there any function/module that allows me to open a directory in the > default file manager of a operating system? On Windows you can use os.startfile(). On "pure" Unices there's no such thing as filetype associations However, if you use a desktop environment, you can spawn xdg-open

[Tutor] Open a directory in the default file manager

2008-05-15 Thread Tim Michelsen
Hello, is there any function/module that allows me to open a directory in the default file manager of a operating system? Here I a piece of code how to open a URL in the default webbrowser: http://www.python.org/doc/lib/module-webbrowser.html import webbrowser myurl = 'http://www.python.org'

[Tutor] converting all files in a directory with subprocess

2008-05-08 Thread Tim Michelsen
Hello, I am working on a automatic documentation program to convert my txt2tags based documentations sources into HTMl files. I want to use txt2tags via command line. Here's my code: # #!/usr/bin/env python # -*- coding: utf-8 -*- import os import subprocess import fnmatch documentation

Re: [Tutor] Arguments ina separate file

2008-04-21 Thread Tim Michelsen
> I have a big list of arguments, which I would like to > keep in a separate file. How do I pass arguments that > are in a separate file? do you mean like setting? do something like this write them in the file myargs.py import myargs call_my_function(myargs.argument1, myargs.argument2) see a

Re: [Tutor] cut all decimal places with zeros

2008-04-15 Thread Tim Michelsen
>> how can I suppress the decimal places for (only those) numbers whos >> decimal places are zero (0)? > > I don't know how to do this with just string formatting but I think > ('%.4f' % n).rstrip('.0') > will do what you want. No. I tested with n = 10.0 You code returns '1' My code returns '10'

Re: [Tutor] setting program configuration for all files and modules ofa program

2008-04-15 Thread Tim Michelsen
>>> But to my optinion Config Parser offers the following advantage: >>> - Readable >>> - All are strings => no strange 'mysetting' is needed. >> I'm not sure what you mean. The Python variables and dictionary >> is all strings too. mysetting is just a string... > > He means, with ConfigParser st

Re: [Tutor] setting program configuration for all files and modules ofa program

2008-04-15 Thread Tim Michelsen
>>> Another option is to have the config settiongs in a normal >>> Python module and just import it. > >> I think that the cfg-files are much more readable for others. > > More readable than: > > # Section Heading > variable = value > > It looks pretty easy to read to me! :-) > > If its very

Re: [Tutor] setting program configuration for all files and modules ofa program

2008-04-14 Thread Tim Michelsen
> Yes, thats the way I'd recommend. >> Is there a more decent and elegant way? I don't know. I was just asking how other programmers achive this efficiently. > Another option is to have the config settiongs in a normal > Python module and just import it. That is less appealing if > the config fi

[Tutor] cut all decimal places with zeros

2008-04-14 Thread Tim Michelsen
Hello, how can I suppress the decimal places for (only those) numbers whos decimal places are zero (0)? Example: CODE In [1]: m = 2.0 In [2]: n = 2.56789080 In [3]: n_format = '%.4f' %n In [4]: n_format Out[4]: '2.5679' In [5]: m_format = '%.4f' %m In [6]: m_format Out[6]: '2.00

[Tutor] setting program configuration for all files and modules of a program

2008-04-14 Thread Tim Michelsen
Hello, I am building a simple GUI for a calculation program. I am using config files (*.cfg) and reading them in with ConfigParser. This works well because I have nearly all code in 1 text file. But I would like to modularize my code and separate the GUI code from the functional code that provid

Re: [Tutor] reading parts of a input string into different variables based on units.

2008-03-19 Thread Tim Michelsen
Hello, thank you for the fast reply! > A regex would avoid that since it would detect an m > as being diffrent to a cm or mm. > > Of course you will have to work out the right regex but that > shouldn't be too difficult if you are sure you have a whitespace > separator and a number followed by th

Re: [Tutor] loading modules only when needed and PEP 008

2008-03-19 Thread Tim Michelsen
> When I do this sort of thing I like > to move my imports into my functions/methods. Would this then be compliant with the style recommendations? > The 'main' code then > conditionally calls the function/method. All the code in the > function safely assumes that the import has been done but co

[Tutor] reading parts of a input string into different variables based on units.

2008-03-19 Thread Tim Michelsen
Hello, I would like to read several parts of a string into different variables based on the (physical) units of the quantities. Here's my testing code: ### mystring = '2m 4cm 3mm' # can also be '1pound 30pence', ... mylist = mystring.split(" ") print mylist first = mylist[0] second =

[Tutor] loading modules only when needed and PEP 008

2008-03-19 Thread Tim Michelsen
Hello fellow Pythonistas, I have a question concerning import statements. My code uses matplotlib to plot the results of my calculations. Since I want to make this plotting functionality a optional feature I would like to import matplotlib only when needed because it takes a lot of time for a T

Re: [Tutor] using os module on windows

2008-02-21 Thread Tim Michelsen
> Delete, then copy. Or use rsync instead of Python... Yes, I ended up writing a small *.bat file that uses unison for sychronization. I still do not understand why I got these permission errors when using the python script. Thanks for the help. ___

[Tutor] send file/mail to imap

2007-12-28 Thread Tim Michelsen
Hello, I have a mbox file locally on my notebook. I would like to send this file to my IMAP account using python. Does anyone know a module or tutorial which does this? I tried * IMAPClient 0.3 - http://pypi.python.org/pypi/IMAPClient/0.3 but it doesn't contain a send function. Thanks in advanc

Re: [Tutor] detecting a change in a iterable object (list, array, etc.)

2007-12-18 Thread Tim Michelsen
Hello, > A list comprehension will work for this. If data is a list of triples of > (year, month, volume) then this will give you a list of the 1997 triples: > > data1997 = [ item for item in data if item[0]==1997 ] I tried your code out (see below). Here is the output: [] [] [] [] [] [1990,

Re: [Tutor] detecting a change in a iterable object (list, array, etc.)

2007-11-27 Thread Tim Michelsen
Hello, > If you show us what you have done so far it would be easier to make > suggestions. The thing is that I am working a lot with time series data and need to write criteria based filters for that data. There's already a start in SciPy Time Series package: http://www.scipy.org/SciPyPackages/Tim

[Tutor] detecting a change in a iterable object (list, array, etc.)

2007-11-26 Thread Tim Michelsen
Example data: Yearmonth volume 19971 2 19972 2 19973 2 19974 5 19975 2 19977 1 19981 2 19982 6 19983 3 19984 3 19985 3 19986 1 Thanks and kind regards, Tim

Re: [Tutor] symbol encoding and processing problem

2007-10-16 Thread Tim Michelsen
> How do you get this output? The print is after the statement causing the > traceback. Are you showing the same code as you ran? Yes. I created this file in PythonWin and run it with IPython. > It displays correctly for me (on MacOS X). Are you sure your source is > actually encoded in utf-8? N

[Tutor] symbol encoding and processing problem

2007-10-16 Thread Tim Michelsen
Dear list, I have encountered a problem with encoding of user input and variables. I want to read in user defined coordinates as a string like: 121° 55' 5.55'' Furthermore I would like to extract the degrees (integer number before the " ° " sign), the minutes (integer number before the " ' " sign)

Re: [Tutor] input file encoding

2007-09-11 Thread Tim Michelsen
> Not sure what you mean by "standard encoding" (is this an Ubuntu > thing?) but essentially whenever you're pulling stuff into Python As it was lined out by others I was printing to a linux terminal which had the encoding set to UTF-8. Therefore and for further processing of the data I had to ope

[Tutor] input file encoding

2007-09-10 Thread Tim Michelsen
Hello, I want to process some files encoded in latin-1 (iso-8859-1) in my python script that I write on Ubuntu which has UTF-8 as standard encoding. When I use the "print lines_in_myfile" is get some wired symbols. How shold I read those files in or convert their encoding to utf-8? Thanks in ad

Re: [Tutor] Python Book Recommendations [Was:[Re: Security]]

2007-08-19 Thread Tim Michelsen
Hello, >> Univ of Toronto, Indiana Univ, and Caltech. Dr. Wilson wrote about it in >> the magazine of Sigma Xi: >> >> http://www.americanscientist.org/template/AssetDetail/assetid/48548 >> >> It has moved around a lot. It's current official home is on scipy.org: >> >> http://www.swc.scipy.org/ >>

Re: [Tutor] Python Book Recommendations [Was:[Re: Security]]

2007-08-16 Thread Tim Michelsen
Hey bhaaluu and list, > Have you seen this site yet? > > http://osl.iu.edu/~lums/swc/ Many many thanks for this link. Although it should be the most obvious to head to the source (python.org) I didn't go there. The above mentioned tutorial seem to cover exactly what I need and where I want do

Re: [Tutor] Python Book Recommendations [Was:[Re: Security]]

2007-08-15 Thread Tim Michelsen
Hello list, thanks to everybody who shared their experience with books and their usefulness. I think with regard to the other thread that passed lately: Books with exercises and problems to solve - http://article.gmane.org/gmane.comp.python.tutor/42394 we must admit there are two type of learn

[Tutor] FAQ [Was Re: Python Book Recommendations [Was:....]]

2007-08-14 Thread Tim Michelsen
Hello, is there a FAQ for this list where we could put all these recommendations? Thanks, Timmie ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] adapting a converter openoffice

2007-07-26 Thread Tim Michelsen
> When you say nothing happemed I assume you mean the script > never terminated? Yes, you are right. it does not terminate and only blocks the screen. As stated on the site the script needs some special parameters of Openoffice. Therefore, until I step further, I wrap it around a shell script

[Tutor] adapting a converter openoffice

2007-07-26 Thread Tim Michelsen
Hello, I am Python learning in an early stage. I am currently trying to code a converter for openoffice based on PyODConverter: http://www.artofsolving.com/opensource/pyodconverter My goal is to be able to run my script from anywhere in the system (put it in Path) and then convert a file from/t