rstrip()

2010-07-16 Thread Jason Friedman
$ python Python 2.6.4 (r264:75706, Dec 7 2009, 18:43:55) [GCC 4.4.1] on linux2 Type help, copyright, credits or license for more information. x.vsd-dir.rstrip(-dir) 'x.vs' I expected 'x.vsd' as a return value. -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to redirect every urel request to test.py script with the visitors page request as url parameter.

2010-07-20 Thread Jason Friedman
2010/7/20 Νίκος nikos.the.gr...@gmail.com: Hello guys! This is my first post in this group! I do not have an answer to your question, other than to suggest you look at (and/or post) relevant lines from Apache's access.log and error.log. I write mostly to say that, in my experience, folks on

subclass of object

2010-04-02 Thread Jason Friedman
Hi, what is the difference between: def MyClass(object): pass and def MyClass(): pass -- http://mail.python.org/mailman/listinfo/python-list

pythonrag

2010-04-05 Thread Jason Friedman
I saw this posted in the July issue but did not see any follow-up there: $ python Python 2.6.4 (r264:75706, Dec 7 2009, 18:43:55) [GCC 4.4.1] on linux2 Type help, copyright, credits or license for more information. a = 500 b = 500 a == b True a is b False p = 50 q = 50 p == q True p is q

Re: Critic my module

2013-07-27 Thread Jason Friedman
I made a Python3 module that allows users to use certain Linux shell commands from Python3 more easily than using os.system(), subprocess.Popen(), or subprocess.getoutput(). This module (once placed with the other modules) can be used like this Looks similar to

Elegant compare

2013-08-10 Thread Jason Friedman
class my_class: def __init__(self, attr1, attr2): self.attr1 = attr1 #string self.attr2 = attr2 #string def __lt__(self, other): if self.attr1 other.attr1: return True else: return self.attr2 other.attr2 I will run into problems if

Re: Elegant compare

2013-08-11 Thread Jason Friedman
This is a hard question to answer, because your code snippet isn't clearly extensible to the case where you have ten attributes. What's the rule for combining them? If instance A has five attributes less than those of instance B, and five attributes greater than those of instance B, which

Re: Could you verify this, Oh Great Unicode Experts of the Python-List?

2013-08-12 Thread Jason Friedman
I've always wondered if the 160 character limit or whatever it is is a hard limit in their system, or if it's just a variable they could tweak if they felt like it. I thought it was 140 characters? https://twitter.com/about -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 450 Adding a statistics module to Python

2013-08-17 Thread Jason Friedman
NumPy and SciPy are not available for many Python users, including those using a Python implementation for which there is no Numpy support URL:http://new.scipy.org/faq.html#python-version-support and those for whom large, dependency-heavy third-party packages are too much burden. See the

Re: Python and mysql 3 tier programming

2013-08-23 Thread Jason Friedman
System Debian Wheezy Linux Python 2.7 Mysql 5.5.31 Apache Server I am somewhat conversant with html, css, SQL, mysql, Apache and Debian Linux. Actually I have been using Debian for over 10 year. I spent over 5 year, prior to retirement, programming database based applications in Foxpro. I

Weighted choices

2013-09-07 Thread Jason Friedman
choices = dict() choices[apple] = 10 choices[pear] = 20 choices[banana] = 15 choices[orange] = 25 choices[kiwi] = 30 I want to pick sets of fruit, three in a set, where the chance of selecting a given fruit is proportional to its weight. In the example above, pears should appear twice as often

Re: Weighted choices

2013-09-09 Thread Jason Friedman
I coach a flag football team of 11-year-olds. A stated goal of the league is that every player should get nearly equal playing time and that winning is of secondary importance. That said, some players just can't throw the ball at all, and having a quarterback who cannot throw is no fun for

Inter-process locking

2013-10-11 Thread Jason Friedman
I have a 3rd-party process that runs for about a minute and supports only a single execution at a time. $ deploy If I want to launch a second process I have to wait until the first finishes. Having two users wanting to run at the same time might happen a few times a day. But, these users will

Re: Inter-process locking

2013-10-12 Thread Jason Friedman
The lockfile solution seems to be working, thank you. On Fri, Oct 11, 2013 at 10:15 PM, Piet van Oostrum p...@vanoostrum.org wrote: Jason Friedman jsf80...@gmail.com writes: I have a 3rd-party process that runs for about a minute and supports only a single execution at a time. $ deploy

Re: OT: looking for best solutions for tracking projects and skills

2013-10-13 Thread Jason Friedman
I highly recommend JIRA, free for non-profit use: https://www.atlassian.com/software/jira. On Fri, Oct 11, 2013 at 9:09 PM, Jason Hsu jhsu802...@gmail.com wrote: I realize this is off-topic, but I'm not sure what forum is best for asking about this. I figure that at least a few of you are

Re: Inter-process locking

2013-10-18 Thread Jason Friedman
There is one caveat, however. If a process that has the lock crashes without releasing the lock, the lock file will stay around and prevent other processes to acquire it. Then you will have to manually remove it. I generally prefer a solution where the pid of the locking process is written

Mail client wrapping

2013-10-29 Thread Jason Friedman
I am receiving lines like this: Accordingly, this element has largely given way in modern cases to a less = rigid formulation: that the evidence eliminates, to a sufficient degree, = other responsible causes (including the conduct of the plaintiff and third= parties). For example, in New York

Re: Debugging decorator

2013-11-03 Thread Jason Friedman
I wrote this decorator: https://gist.github.com/yasar11732/7163528 I ran it with Python 2 and thought it was neat. Most of my work is Python 3. I ran 2to3-3.3 against it and I am getting this error: $ ./simple.py Traceback (most recent call last): File ./simple.py, line 3, in module

Re: Parsing multiple lines from text file using regex

2013-11-03 Thread Jason Friedman
Hi, I am having an issue with something that would seem to have an easy solution, but which escapes me. I have configuration files that I would like to parse. The data I am having issue with is a multi-line attribute that has the following structure: banner option banner text delimiter

Re: Dumping all the sql statements as backup

2012-08-30 Thread Jason Friedman
I have some long running processes that do very long simulations which at the end need to write things on a database. At the moment sometimes there are network problems and we end up with half the data on the database. The half-data problem is probably solved easily with sessions and

Re: Python newbie here! No module named settings

2012-09-07 Thread Jason Friedman
I was trying to use Python wrapper for Google Charts API and was tweaking the examples. https://github.com/gak/pygooglechart/raw/master/examples/pie.py This is the script which I was trying. And the python interpreter gives the following error: import settings ImportError: No module

Re: simple client data base

2012-09-08 Thread Jason Friedman
Mark R Rivet wrote: Hello all, I am learning to program in python. I have a need to make a program that can store, retrieve, add, and delete client data such as name, address, social, telephone number and similar information. This would be a small client database for my wife who has a home

Re: submit jobs on multi-core

2012-09-12 Thread Jason Friedman
I have a python script in which I have a list of files to input one by one and for each file I get a number as an output. I used for loop to submit the file to script. My script uses one file at a time and returns the output. My computers has 8 cores. Is there any way that I could submit 8

Re: using text file to get ip address from hostname

2012-09-12 Thread Jason Friedman
i need to get an ip address from list of hostnames which are in a textfile. this is what i have so far -- #!/usr/bin/env python #Get the IP Address import socket hostname = 'need it to read from a text file' addr =

Re: datetime issue

2012-09-15 Thread Jason Friedman
# get some enviromental values locale.setlocale(locale.LC_ALL, 'el_GR') date = datetime.datetime.now().strftime( '%y-%m-%d %H:%M:%S' ) although iam setting greek as locale the time is 8 hours before, like in texas, us How can i change this to save the correct Greek time in variable $date

Re: 'indent'ing Python in windows bat

2012-09-18 Thread Jason Friedman
I'm converting windows bat files little by little to Python 3 as I find time and learn Python. The most efficient method for some lines is to call Python like: python -c import sys; sys.exit(3) How do I indent if I have something like: if (sR=='Cope'): sys.exit(1) elif (sR=='Perform')

Re: Programming Issues

2012-09-19 Thread Jason Friedman
Ask the user for the amount of change expressed in cents. Your program must compute and display the number of half-dollars, quarters, dimes, nickels, and pennies to be returned. Return as many half-dollars as possible, then quarters, dimes, nickels, and pennies, in that order. Your program

Re: Article on the future of Python

2012-09-27 Thread Jason Friedman
Fair enough, but it's the M in the LAMP stack I object to. I'd much rather have P. +1 -- http://mail.python.org/mailman/listinfo/python-list

parse an environment file

2012-09-30 Thread Jason Friedman
$ crontab -l * * * * * env This produces mail with the following contents: HOME=/home/spjsf LOGNAME=spjsf PATH=/usr/bin:/bin PWD=/home/spjsf SHELL=/bin/sh SHLVL=1 USER=spjsf _=/usr/bin/env On the other hand $ env produces about 100 entries, most of which are provided by my .bashrc; cron

Re: parse an environment file

2012-10-01 Thread Jason Friedman
I want my python 3.2.2 script, called via cron, to know what those additional variables are. How? Thank you for the feedback. A crontab line of * * * * * . /path/to/export_file /path/to/script.py does indeed work, but for various reasons this approach will not always be available to me.

Re: parse an environment file

2012-10-02 Thread Jason Friedman
Ah, fair enough. Well, since you're using the full range of bash functionality, the only viable way to parse it is with bash itself. I'd recommend going with the version you have above: * * * * * . /path/to/export_file /path/to/script.py Under what circumstances is this not an option?

Re: parse an environment file

2012-10-06 Thread Jason Friedman
The only canned solution for parsing a bash script is bash. Think about it the other way around: If you wanted to have a Python variable made available to a bash script, the obvious thing to do is to invoke Python. It's the same thing. I scratched my own itch:

Re: notmm is dead!

2012-10-07 Thread Jason Friedman
It was a _joke_ referring to Michael Torrie's email addressing the 8 Dihedral bot _as if it was a person_. Well it would be useful to probe the bot's parameters... Five eights is a busy bot:

Re: Interest in seeing sh.py in the stdlib

2012-10-21 Thread Jason Friedman
I'm interested in making sh.py more accessible to help bring Python forward in the area of shell scripting, so I'm interested in seeing if sh would be suitable for the standard library. Is there any other interest in something like this? Pretty slick. My only concern is portability, are

Re: Split single file into multiple files based on patterns

2012-10-23 Thread Jason Friedman
I have a text file like this A1980JE3937 2732 4195 12.527000 A1980JE3937 3465 9720 22.00 A1980KK18700010 186 3366 4.78 A1980KK18700010 30 186 1.285000 A1980KK18700010 30 185 4.395000 A1980KK18700010 185 186 9.00 A1980KK18700010 25 30 3.493000 I want to split the file

Re: Split single file into multiple files based on patterns

2012-10-23 Thread Jason Friedman
On Tue, Oct 23, 2012 at 9:01 PM, satyam dirac@gmail.com wrote: I have a text file like this A1980JE3937 2732 4195 12.527000 A1980JE3937 3465 9720 22.00 A1980JE3937 1853 3278 12.50 A1980JE3937 2732 2732 187.50 A1980JE3937 19 4688 3.619000 A1980KK18700010

Re: SSH Connection with Python

2012-10-25 Thread Jason Friedman
how can i create a SSH-Connection with python? I have to send some commands to the remote host and parse their answers. Consider also the sh module: http://amoffat.github.com/sh/tutorials/2-interacting_with_processes.html. -- http://mail.python.org/mailman/listinfo/python-list

Re: Migrate from Access 2010 / VBA

2012-11-22 Thread Jason Friedman
I am the lone developer of db apps at a company of 350+ employees. Everything is done in MS Access 2010 and VBA. I'm frustrated with the limitations of this platform and have been considering switching to Python. I've been experimenting with the language for a year or so, and feel

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-10 Thread Jason Friedman
Thesaurus is a new a dictionary subclass which allows calling keys as if they are class attributes and will search through nested objects recursively when __getitem__ is called. Good stuff. You might consider: 1) Licensing under an OSI-approved license

Re: Trying to make a basic Python score counter in a game... will not count.

2012-12-17 Thread Jason Friedman
if you're interested in learning Python and/or game programming in Python, you might want to take a look at http://inventwithpython.com/ And https://www.coursera.org/course/interactivepython. -- http://mail.python.org/mailman/listinfo/python-list

ImportError: /usr/local/lib/python3.2/dist-packages/OpenSSL/SSL.cpython-32mu.so: undefined symbol: SSLv2_method

2012-12-27 Thread Jason Friedman
Hello, I downloaded: https://launchpad.net/pyopenssl/main/0.11/+download/pyOpenSSL-0.11.tar.gz Then: $ python3 setup.py build $ sudo python3 setup.py install Then: $ python3 -c from OpenSSL import SSL Traceback (most recent call last): File string, line 1, in module File OpenSSL/__init__.py,

Re: Suggest an open-source issue tracker, with github integration and kanban boards?

2013-11-15 Thread Jason Friedman
Can you recommend an open source project (or two) written in Python; which covers multi project + sub project issue tracking linked across github repositories? Why does it need to be written in Python? -- https://mail.python.org/mailman/listinfo/python-list

Re: Python project

2013-11-30 Thread Jason Friedman
To be perfectly honest, this is much too large a project for you. First read some python tutorials and learn how to code in python. If you work it every day, maybe you can kind of understand what its about in a very superficial sense in a month. However, if you are having fun learning, then

Re: multiprocessing: child process share changes to global variable

2013-12-03 Thread Jason Friedman
#--- temp.py - #run at Python 2.7 command prompt import time import multiprocessing as mp lst = [] lstlst = [] def alist(x): lst.append(x) lstlst.append(lst) print a return lst if __name__=='__main__': pool = mp.Pool(3)

Re: Using Python inside Programming Without Coding Technology (PWCT) environment.

2013-12-13 Thread Jason Friedman
http://www.codeproject.com/Articles/693408/Using-Python-inside-Programming-Without-Coding-Tec That page references a license file at http://www.codeproject.com/info/cpol10.aspx but _that_ page would display for me. -- https://mail.python.org/mailman/listinfo/python-list

Re: How to check the date validity?

2013-12-23 Thread Jason Friedman
In this file I have 3 different kind of fields: one consist of the sole date, one - sole time and one - datetime. The time includes milliseconds, i.e. 12:55:55.705 All fields of the file including those 3 I am reading as the string. All those strings after validating will go into mySQL table.

Re: Getting updates and restarting a long running url request.

2013-12-25 Thread Jason Friedman
I am using the following code to submit the query/ def get_BLAST(taxid, queryseq, args=None): ''' Input taxid to BLAST queryseq against ''' e_query = txid + taxid + [ORGN] #, other_advanced='-G 4 -E 1' blast_result = NCBIWWW.qblast(blastn, nt, queryseq,

Re: Getting updates and restarting a long running url request.

2013-12-26 Thread Jason Friedman
Would this not keep requesting/submitting additional (duplicate) BLAST queries? try: this_result = get_BLAST(id) result_dict[id] = True I assumed that NCBIWWW.qblast waits for a response from the server. Are you saying that instead it queues a request, and the

Re: lookup xpath (other?) to value in html

2013-12-31 Thread Jason Friedman
I have a about 255 data fields that I am trying to verify on thousands of webpages. For example: value: 255,000 sqft: 1800 Since I have the correct answer for several pages I would like to lookup get the location (xpath?) of the data/field value in the page so that I can check other

Re: lookup xpath (other?) to value in html

2013-12-31 Thread Jason Friedman
For example this URL; http://jeffco.us/ats/displaygeneral.do?sch=001690 The the land sqft is 11082. Google Chrome gives me the xpath to that data as; //*[@id=content]/p[1]/table[4]/tbody/tr[2]/td[8] What I would like to do (using python) is given 11082 at what xpath can that be found? (may

Flip a graph

2014-01-04 Thread Jason Friedman
I am teaching Python to a class of six-graders as part of an after-school enrichment. These are average students. We wrote a non-GUI rocket lander program: you have a rocket some distance above the ground, a limited amount of fuel and a limited burn rate, and the goal is to have the rocket

Re: Process datafeed in one MySql table and output to another MySql table

2014-01-16 Thread Jason Friedman
I have a datafeed which is constantly sent to a MySql table. The table grows constantly as the data feeds in. I would like to write a python script which process the data in this table and output the processed data to another table in another MySql database in real-time. Which are the

Re: Unwanted Spaces and Iterative Loop

2014-01-26 Thread Jason Friedman
outHandler.write(FarmID\tAddress\tStreetNum\tStreetName\tSufType\tDir\tCity\tProvince\tPostalCode) ... FarmID Address 1 1067 Niagara Stone Rd, Niagara-On-The-Lake, ON L0S 1J0 2 4260 Mountainview Rd, Lincoln, ON L0R 1B2 3 25 Hunter Rd, Grimsby, ON L3M 4A3 4 1091

Re: Unwanted Spaces and Iterative Loop

2014-01-26 Thread Jason Friedman
I`m not reading and writing to the same file, I just changed the actual paths to directory. This is for a school assignment, and we haven`t been taught any of the stuff you`re talking about. Although I appreciate your help, everything needs to stay as is and I just need to create the loop

Google API and Python 2

2014-02-09 Thread Jason Friedman
I started Python programming in the last few years and so I started with version 3 and 99% of my code is in version 3. Much of Google API Python code seems to be Python 2. I can convert the occasional file to version 3 with 2to3, but for an entire 3rd-party library, could it be as simple as

Re: Why does this hang sometimes?

2012-04-07 Thread Jason Friedman
I am just playing around with threading and subprocess and found that the following program will hang up and never terminate every now and again. import threading import subprocess import time def targ():    p = subprocess.Popen([/bin/sleep, 2])    while p.poll() is None:        

Re: Sharing Data in Python

2012-05-17 Thread Jason Friedman
I have some Pickled data, which is stored on disk, and it is about 100 MB in size. When my python program is executed, the picked data is loaded using the cPickle module, and all that works fine. If I execute the python multiple times using python main.py for example, each python

Re: python3 raw strings and \u escapes

2012-06-15 Thread Jason Friedman
This is a related question. I perform an octal dump on a file: $ od -cx file 000 h e l l o w o r l d \n 65686c6c206f6f776c720a64 I want to output the names of those characters: $ python3 Python 3.2.3 (default, May 19 2012, 17:01:30)

Re: python3 raw strings and \u escapes

2012-06-15 Thread Jason Friedman
This is a related question. I perform an octal dump on a file: $ od -cx file 000   h   e   l   l   o       w   o   r   l   d  \n            6568    6c6c    206f    6f77    6c72    0a64 I want to output the names of those characters: $ python3 Python 3.2.3 (default, May 19 2012,

Read STDIN as bytes rather than a string

2012-06-18 Thread Jason Friedman
I tried this: Python 3.2.2 (default, Feb 24 2012, 20:07:04) [GCC 4.6.1] on linux2 Type help, copyright, credits or license for more information. import sys import io fh = io.open(sys.stdin) Traceback (most recent call last): File stdin, line 1, in module TypeError: invalid file:

Re: Read STDIN as bytes rather than a string

2012-06-18 Thread Jason Friedman
sys.stdin wraps a buffered reader which itself wraps a raw file reader. sys.stdin _io.TextIOWrapper name='stdin' mode='r' encoding='UTF-8' sys.stdin.buffer _io.BufferedReader name='stdin' sys.stdin.buffer.raw _io.FileIO name='stdin' mode='rb' You should read from sys.stdin.buffer unless

Re: Read STDIN as bytes rather than a string

2012-06-18 Thread Jason Friedman
Which leads me to another question ... how can I debug these things? $ echo 'hello' | python3 -m pdb ~/my-input.py /home/jason/my-input.py(2)module() - import sys (Pdb) *** NameError: name 'hello' is not defined -- http://mail.python.org/mailman/listinfo/python-list

Re: simpler increment of time values?

2012-07-04 Thread Jason Friedman
Hi all, I'd like to ask about the possibilities to do some basic manipulation on timestamps - such as incrementing a given time (hour.minute - string) by some minutes. Very basic notion of time is assumed, i.e. dateless, timezone-unaware, DST-less etc. I first thought, it would be possible

Re: Search and replace text in XML file?

2012-07-27 Thread Jason Friedman
I'm looking to search an entire XML file for specific text and replace that text, while maintaining the structure of the XML file. The text occurs within multiple nodes throughout the file. I basically need to replace every occurrence C:\Program Files with C:\Program Files (x86),

Re: Fibonacci series recursion error

2011-04-29 Thread Jason Friedman
import os def fib(n):        if n == 1:          return(n)        else:          return (fib(n-1)+fib(n-2)) list=fib(20) print(list) The above function return the return (fib(n-1)+fib(n-2)) RuntimeError: maximum recursion depth exceeded in comparison [36355 refs] can any one help

Embedding Python in a shell script

2011-06-16 Thread Jason Friedman
$ cat test.sh #!/bin/bash for i in 1 2 3 4; do python -c for j in range($i): print j done $ sh test.sh 0 0 1 0 1 2 0 1 2 3 The code behaves as I expect and want, but the de-denting of the Python call is unattractive, especially unattractive the longer the Python call becomes. I'd prefer

Re: Embedding Python in a shell script

2011-06-17 Thread Jason Friedman
Thank you, everyone, for your suggestions. I'll try them all and decide which I like best. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to extract contents of inner text of html tag?

2014-03-08 Thread Jason Friedman
for line in all_kbd: if line.string == None: I modified your code slightly: for line in all_kbd: print(line) sys.exit() if line.string == None: Running the new script yields: $ python shibly.py kbd class=command cp -v --remove-destination /usr/share/zoneinfo/ em

Re: writing reading from a csv or txt file

2014-03-30 Thread Jason Friedman
I am trying to compare the files. cutting out items in list list. ie:- first file (rainfall2012.csv)rainfall, duration,time of day,wind speed,date. first file (rainfall2013.csv)rainfall, duration,time of day,wind speed,date. I would like to pick out maybe rainfalls and duration's and

Re: realtime plot

2014-04-01 Thread Jason Friedman
I want to plot serial data from Arduino by Chaco. Could you help me and guide me about that. I found this: http://www.blendedtechnologies.com/realtime-plot-of-arduino-serial-data-using-python/231 . -- https://mail.python.org/mailman/listinfo/python-list

Re: writing reading from a csv or txt file

2014-04-01 Thread Jason Friedman
Hi jason thanks for replying.Below is a typical file return.To you I've no doubt this is a simple problem but,to a beginner like me it just seems I lack the understanding of how to split out the items in a list.Thanks again for looking at it. Rainfall,duration,TimeStart,windspeed,Date

Ubuntu 3 (was Adding thread module support to Ubuntu 3 for Python3)

2014-06-23 Thread Jason Friedman
OT and FWIW: I gave up on Ubuntu when they switched to Unity -- I find that very awkward to use. Just personal opinion, of course, and I know there are others who like it -- that's fine with me as well. (But I switched to Mint.) Likewise, though with me it was Debian I went to, with Xfce

Re: subprocess can not kill when app exit()

2014-06-25 Thread Jason Friedman
code in below, when close the app window. the two ping process can not kill auto and keep in the windows 7 task list. During running, ping process under Python.exe as two thread. When app exit, this two process move the system process and keep running there. could someone help to

Re: merging argparse parsers

2011-12-23 Thread Jason Friedman
I would like to have something like merged_parser = LoggingParser() + OtherParser() Which should create an argument parser with all the options composed. I have used parent parsers. http://docs.python.org/py3k/library/argparse.html#parents I think in your case merged_parser would become

Re: modifying a time.struct_time

2011-12-23 Thread Jason Friedman
On Fri, Dec 16, 2011 at 10:44 AM, Chris Angelico ros...@gmail.com wrote: On Fri, Dec 16, 2011 at 8:45 PM, Ulrich Eckhardt ulrich.eckha...@dominolaser.com wrote: I'm trying to create a struct_time that is e.g. one year ahead or a month back in order to test some parsing/formatting code with

Re: Regular expressions

2011-12-26 Thread Jason Friedman
On Tue, Dec 27, 2011 at 10:45 AM, mauricel...@acm.org mauricel...@gmail.com wrote: Hi I am trying to change one string to another string. Can anyone help me with the regular expressions needed? A regular expression defines a string based on rules. Without seeing a lot more strings, we

Re: Regular expressions

2011-12-26 Thread Jason Friedman
Thanks a lot everyone. Can anyone suggest a good place to learn REs? Start with the manual: http://docs.python.org/py3k/library/re.html#module-re -- http://mail.python.org/mailman/listinfo/python-list

Re: mutually exclusive arguments to a constructor

2011-12-30 Thread Jason Friedman
Suppose I'm creating a class that represents a bearing or azimuth, created either from a string of traditional bearing notation (N24d30mE) or from a number indicating the angle in degrees as usually measured in trigonometry (65.5, measured counter-clockwise from the x-axis).  The class will

Re: Python lib for creating Database tables

2012-01-11 Thread Jason Friedman
Hello All, I just made something pretty simple that I intend to use while creating database tables. It is still in the basic form, and much needs to be added. However, I use introspection to make it a bit easier and less work on the user. I would want my code to be reviewed by this great

logging and httphandler

2012-01-13 Thread Jason Friedman
I am logging to my Apache web server, using this Apache format: LogFormat %{%Y-%m-%d %H:%M:%S}t %U %q scriptlog CustomLog /var/log/apache2/script.log scriptlog My code is as follows: #!/usr/bin/env python3 import logging, logging.handlers, sys logger = logging.getLogger('simple_example')

Re: scientific notation in legend (pylab)

2012-01-14 Thread Jason Friedman
I I would like to have numbers expressed in scientific notation in legend annotations. Does anybody know how to do that? Not sure why legend annotations makes the problem different, but perhaps this is a start: $ python3 Python 3.2 (r32:88445, Jun 11 2011, 10:38:04) [GCC 4.4.3] on linux2 Type

Re: why i can get nothing?

2012-01-15 Thread Jason Friedman
here is my code : import urllib import lxml.html down='http://download.v.163.com/dl/open/00DL0QDR0QDS0QHH.html' file=urllib.urlopen(down). read() root=lxml.html.document_fromstring(file) tnodes = root.xpath(//a/@href[contains(string(),'mp4')]) for i,add in enumerate(tnodes):     print 

Re: scientific notation in legend (pylab)

2012-01-18 Thread Jason Friedman
thank you, I am trying to learn python, but I am having a hard to find a good introduction to it. Try this: http://docs.python.org/py3k/tutorial/ -- http://mail.python.org/mailman/listinfo/python-list

python zipfile v. native unzip

2012-01-31 Thread Jason Friedman
Does Python 2.7's zipfile module use its own algorithm or does it leverage the zip/unzip libraries that exist on the host? I ask because my host's native unzip program cannot handle files that, when unzipped, are larger than 2GB. Will using Python 2.7 get around this limitation? --

Installing pypi package twice

2012-01-31 Thread Jason Friedman
My system's default python is 2.6.5. I have separately installed 3.2.2 at /opt/python. I downloaded python-daemon-1.5.5 and installed with: $ tar xzf python-daemon-1.5.5 $ cd python-daemon-1.5.5 $ python setup.py build $ sudo python setup.py install How would I also install this package for

Installing pypi package twice

2012-01-31 Thread Jason Friedman
My system's default python is 2.6.5. I have also installed python3.2 at /opt/python. I installed a pypi package for 2.6.5 with: $ tar xzf package.tar.gz $ cd package $ python setup.py build $ sudo python setup.py install How can I also install this same package for 3.2? (I am assuming this

Use logging level across application and modules

2012-02-02 Thread Jason Friedman
Base module: http://pastebin.com/nQCG5CRC Another module: http://pastebin.com/FFzCCjwG Application: http://pastebin.com/370cWJtT I have a module that will provide base functionality, such as logging and authentication. I have other specialized modules that provide additional functionality.

Re: Use logging level across application and modules

2012-02-02 Thread Jason Friedman
Base module:  http://pastebin.com/nQCG5CRC Another module:  http://pastebin.com/FFzCCjwG Application:  http://pastebin.com/370cWJtT I have a module that will provide base functionality, such as logging and authentication. I have other specialized modules that provide additional

parse a profile

2012-02-18 Thread Jason Friedman
I have a file I use for shell scripts that looks like this: export VAR1=/path/to/dir export VAR2=7 export VAR3=${VAR1}/further/path # comment . /another/file And a file /another/file: export VAR4=database-name Is there an existing package that will read such a file and return a dictionary like

HTTP logging

2012-02-20 Thread Jason Friedman
I am logging to HTTP: logger.addHandler(logging.handlers.HTTPHandler(host, url)) Works great, except if my HTTP server happens to be unavailable: socket.error: [Errno 111] Connection refused Other than wrapping all my logger.log() calls in try/except blocks, is there a way to skip logging to

SSL on 3.2.2

2012-02-24 Thread Jason Friedman
Hello, attempting to build from source on Ubuntu 11.10. Before running ./configure I had set this in Modules/Setup.dist: SSL=/usr/lib/ssl _ssl _ssl.c \ -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ -L$(SSL)/lib -lssl -lcrypto $ ll /usr/lib/ssl total 4 lrwxrwxrwx 1 root

Re: argparse ConfigureAction problem

2012-03-26 Thread Jason Friedman
./plot_stuff2.py --plot stuff1 stuff2 [...] plot_stuff2.py: error: argument --plot/--with-plot/--enable-plot/--no-plot/-- without-plot/--disable-plot: invalid boolean value: 'stuff1' Problem is --plot takes an optional argument, and so the positional arg is assumed to be the arg to --plot.  

Subprocess does not return for longer-running process

2010-09-21 Thread Jason Friedman
Hello, The Popen call does not return if the underlying OS call runs longish, as the example below shows. Although, if the underlying OS call is merely sleep N it will return even after quite a long time. wikiu...@dvprwiki1:~ python --version Python 2.6.4 wikiu...@dvprwiki1:~ time

Re: finditer

2014-07-07 Thread Jason Friedman
On Mon, Jul 7, 2014 at 1:19 AM, gintare g.statk...@gmail.com wrote: If smbd has time, maybe you could advice how to accomplish this task in faster way. I have a text = word{vb} wordtransl {vb} sent1. sent1trans. sent2 sent2trans... I need to match once wordtransl, and than many

Re: Help with regular expression in python

2011-08-19 Thread Jason Friedman
Hi Josh, thanks for the reply. I am no expert so please bear with me: I thought that the {32} was supposed to match the previous expression 32 times? So how can i have all matches accessible to me? $ python Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) [GCC 4.4.3] on linux2 Type help,

Re: Review Python site with useful code snippets

2011-10-29 Thread Jason Friedman
On Wed, Oct 26, 2011 at 3:51 PM, Chris Hall cha...@gmail.com wrote: I am looking to get reviews, comments, code snippet suggestions, and feature requests for my site. I intend to grow out this site with all kinds of real world code examples to learn from and use in everyday coding. The site

Re: How do you call a function several times in this context??

2013-01-06 Thread Jason Friedman
def double(value): result return result number=input('type a number') print (double(int(number))) I think what was meant: def double(value): result = 2 * value return result -- http://mail.python.org/mailman/listinfo/python-list

Re: [Offtopic] Line fitting [was Re: Numpy outlier removal]

2013-01-08 Thread Jason Friedman
Statistical analysis is a huge science. So is lying. And I'm not sure most people can pick one from the other. Chris, your sentence causes me to think of Mr. Twain's sentence, or at least the one he popularized: http://www.twainquotes.com/Statistics.html. --

Re: [Offtopic] Line fitting [was Re: Numpy outlier removal]

2013-01-08 Thread Jason Friedman
Statistical analysis is a huge science. So is lying. And I'm not sure most people can pick one from the other. Chris, your sentence causes me to think of Mr. Twain's sentence, or at least the one he popularized: http://www.twainquotes.com/Statistics.html. --

Re: ANN: Python training text movies

2013-01-13 Thread Jason Friedman
That is right; I would also add that it may be overwhelming for a newbie to be reading through a large wall of text -- here you have blank space after the current paragraph so the attention is focused even more on the last few lines. Additionally, since instructions scroll automatically, I

  1   2   3   >