On Wed, Aug 21, 2024 at 4:04 PM Daniel via Python-list <
python-list@python.org> wrote:
>
> An example of use, here's a weather service tied to a finger. Put your
> city name as the user. This isn't mine, but it is inspiring. Example:
>
> finger mi...@graph.no
>
> For all options, go to the help f
On Sun, Nov 5, 2023 at 1:23 PM office officce via Python-list <
python-list@python.org> wrote:
> which python version is better to be used and how to make sure it works on
> my window 10 because i downloaded it and it never worked so I uninstall to
> do that again please can you give me the steps
def construct_response(exit_code: int, message: str) -> Response:
>> """
>> Construct a Flask-suitable response
>>
>> :param exit_code: 0 or something else
>> :param message: something useful
>> :return: a Flask-suitable response
>> """
>>
>>
>> @app.route(f"/{version}/", me
And I can answer my own Question 2:
:func:`my_project.main_application.construct_response`
On Mon, Aug 28, 2023 at 1:39 PM Jason Friedman wrote:
> def construct_response(exit_code: int, message: str) -> Response:
>> """
>> Construct a Flask-suitable re
>
> def construct_response(exit_code: int, message: str) -> Response:
> """
> Construct a Flask-suitable response
>
> :param exit_code: 0 or something else
> :param message: something useful
> :return: a Flask-suitable response
> """
>
>
> @app.route(f"/{version}/", methods=
I have two questions, please (this is after reading
https://docs.readthedocs.io/en/stable/guides/cross-referencing-with-sphinx.html#automatically-label-sections
).
This is my project structure:
my_project
api
stuff1.py
stuff2.py
lib
stuff3.py
stuff4.py
main_application.py
I want to be able to write code like this:
with Database() as mydb:
conn = mydb.get_connection()
cursor = conn.get_cursor()
cursor.execute("update table1 set x = 1 where y = 2")
cursor.close()
cursor = conn.get_cursor()
cursor.execute("update table2 set a = 1 where b = 2")
cursor.close()
I'd like
>
> Jason Friedman wrote at 2023-8-3 21:34 -0600:
> > ...
> >my_frame = inspect.currentframe()
> > ...
> >My question is: let's say I wanted to add a type hint for my_frame.
>
> `my_frame` will be an instance of `Types.FrameType`.
>
Confirmed. Th
> My question is: let's say I wanted to add a type hint for my_frame.
> >
> > my_frame: some_class_name = inspect.currentframe()
> >
> > What would I put for some_class_name?
> > "frame" (without quotations) is not recognized,
> > Nor is inspect.frame.
>
> We know Python code is executed in an exec
import inspect
def my_example(arg1, arg2):
print(inspect.stack()[0][3])
my_frame = inspect.currentframe()
args,_,_,values = inspect.getargvalues(my_frame)
args_rendered = [f"{x}: {values[x]}" for x in args]
print(args_rendered)
my_example("a", 1)
The above "works" in the sense it prints what I
I'm writing a database connectivity module to be used by other modules and
leveraging the jaydebeapi module.
>From what I can tell jaydebeapi contains no built-in timeout capability, so
then I turned to https://pypi.org/project/timeout-decorator/.
My goal is to have a default timeout of, say, 10 se
3 at 6:01 PM Greg Ewing via Python-list <
python-list@python.org> wrote:
> On 8/06/23 10:18 am, Jason Friedman wrote:
> > SyntaxError: name capture 'RANGE' makes remaining patterns unreachable
>
> The bytecode compiler doesn't know that you intend RANGE
> to be
This gives the expected results:
with open(data_file, newline="") as reader:
csvreader = csv.DictReader(reader)
for row in csvreader:
#print(row)
match row[RULE_TYPE]:
case "RANGE":
print("range")
case "MANDATORY":
print("mandatory")
case _:
print("nothing to do")
This:
RANGE = "RANGE"
MANDATORY
I'm trying to reconcile two best practices which seem to conflict.
1) Use a _with_ clause when connecting to a database so the connection is
closed in case of premature exit.
class_name = 'oracle.jdbc.OracleDriver'
url = f"jdbc:oracle:thin:@//{host_name}:{port_number}/{database_name}"
with jdbc.c
>
> I want learn python for 4 weeks and have problems, installing Tkinter. If
> I installed 3.11.0 for my windows 8.1 from python.org and type
>
> >>> import _tkinter
> > Traceback (most recent call last):
> >File "", line 1, in
> > ImportError: DLL load failed while importing _tkinter
>
>
> Hey All,
>
> I have a set of bash and python scripts that all interact with a remote
> git repository.
>
>
> https://gitpython.readthedocs.io/en/stable/reference.html?highlight=cache#git.index.fun.read_cache
> https://pypi.org/project/git-credential-helpers/
>
> But neither means appears to h
> Hey All,
>
> I have a set of bash and python scripts that all interact with a remote
> git repository.
>
This does not exactly answer your question, but whenever I have wanted to
interact with (popular) software via Python I have checked to see if
someone has already written that code for me.
h
I should state at the start that I have a solution to my problem. I am
writing to see if there is a better solution.
I have a program that runs via crontab every five minutes. It polls a
Box.com folder for files and, if any are found, it copies them locally and
performs a computation on them that
>
> I set listen(2) and expect to see "error" when more clients than "the
> maximum number of queued connections" trying to connect the server. But, no
> error!! Even 4 clients can run normally without problem.
>
> Am I misunderstanding the meaning of this argument?
>
https://docs.python.org/3/lib
>
>
> for path, dir, files in os.walk(myDestinationFolder):
> # for path, dir, files in os.walk(destfolder):
> print('The path is %s: ', path)
> print(files)
> os.chdir(mySourceFolder)
> if not os.path.isfile(myDestinationFolder + file):
> # if not os.path.isfile(destfolder + f
>
> import numpy as np
> import pandas as pd
> from numpy.random import randn
> df=pd.DataFrame(randn(5,4),['A','B','C','D','E'],['W','X','Y','Z'])
>
> W X Y Z
> A -0.183141 -0.398652 0.909746 0.332105
> B -0.587611 -2.046930 1.446886 0.167606
> C 1.142661 -0.861617 -0.180631 1.650463
> D 1.174805
>
> csv.DictReader appears to be happy with a list of strings representing
> the lines.
>
> Try this:
>
> contents = source_file.content()
>
> for row in csv.DictReader(contents.decode('utf-8').splitlines()):
> print(row)
>
Works great, thank you! Question ... will this form potentially use l
Using the Box API:
print(source_file.content())
returns
b'First Name,Last Name,Email Address,Company,Position,Connected
On\nPeter,van
(and more data, not pasted here)
Trying to read it via:
with io.TextIOWrapper(source_file.content(), encoding='utf-8') as text_file:
reader = csv.DictRead
>
> The Box API is noisy ... very helpful for diagnosing, and yet for
> production code I'd like less noise.
>
> I tried this:
>
> warnings.filterwarnings(
> action='ignore',
> # category=Warning,
> # module=r'boxsdk.*'
> )
>
> but I still see this:
>
> WARNING:boxsdk.network.default_ne
The Box API is noisy ... very helpful for diagnosing, and yet for
production code I'd like less noise.
I tried this:
warnings.filterwarnings(
action='ignore',
# category=Warning,
# module=r'boxsdk.*'
)
but I still see this:
WARNING:boxsdk.network.default_network:"POST
https://api.bo
>
>
>> I'm using the Box API (
>> https://developer.box.com/guides/tooling/sdks/python/).
>> I can get an access token, though it expires after a certain amount of
>> time. My plan is to store the access token on the filesystem and use it
>> until it expires, then fetch a new one. In the example be
I'm using the Box API (https://developer.box.com/guides/tooling/sdks/python/).
I can get an access token, though it expires after a certain amount of
time. My plan is to store the access token on the filesystem and use it
until it expires, then fetch a new one. In the example below assume I have
an
>
> I'm looking to insert values into an oracle table (my_table) using the
> query below. The insert query works when the PROJECT is not NULL/empty
> (""). However when PROJECT is an empty string(''), the query creates a new
> duplicate row every time the code is executed (with project value
> popu
>
> import pandas; pd = pandas
>
> >df = pd.from_csv (...)
> >from selenium import webdriver
>
> import selenium.webdriver; webdriver = selenium.webdriver
>
Thank you, this works.
--
https://mail.python.org/mailman/listinfo/python-list
I have some code I'm going to share with my team, many of whom are not yet
familiar with Python. They may not have 3rd-party libraries such as pandas
or selenium installed. Yes I can instruct them how to install, but the path
of least resistance is to have my code to check for missing dependencies
>
> I constructed a lexicon for words that show how different words are linked
> to consumer traits and motivations (e.g. Achievement and Power Motivation).
> Now I have collected a large amount of online customer reviews and want to
> match each review with the word definitions of the consumer tra
You have another thread on this list that refers to general Python
installation issues, so you'll need to work through that.
I'm writing in this thread to say that tensorflow does not (today) support
Python 3.8, you'll want to try 3.7, assuming that tensorflow is a critical
piece for you: https://
>
>
> I have some lines in a text file like
> ADD R1, R2
> ADD3 R4, R5, R6
> ADD.MOV R1, R2, [0x10]
>
Actually I want to get 2 matches. ADD R1, R2 and ADD.MOV R1, R2, [0x10]
> because these two lines are actually "ADD" instructions. However, "ADD3" is
> something else.
>
>>> s = """ADD R1, R
>
>
> When I define the X and Y values for prediction in the train and test
> data, should I capture all the columns that has been "OneHotEncoded" (that
> is all columns with 0 and 1) for the X and Y values???
>
You might have better luck asking on Stackoverflow, per the Pandas
instructions: https
>
> Chris Angelico: [PSF's] 2019 Q2 Community Service Award Winner
> http://pyfound.blogspot.com/2019/10/chris-angelico-2019-q2-community.html
>
> ...and for the many assistances and pearls of wisdom he has contributed
> 'here'!
> --
> Regards,
> =dn
>
> Agreed.
--
https://mail.python.org/mailman/
>
> If you're certain that the headers are the same in each file,
> then there's no harm and much simplicity in reading them each
> time they come up.
>
> with fileinput ...:
> for line in f:
> if fileinput.isfirstline():
> headers = extract_headers(line)
import csv
import fileinput
import sys
print("Version: " + str(sys.version_info))
print("Files: " + str(sys.argv[1:]))
with fileinput.input(sys.argv[1:]) as f:
for line in f:
print(f"File number: {fileinput.fileno()}")
print(f"Is first line: {fileinput.isfirstline()}")
I run
>
> If I have path: /home/admin/hello/yo/{h1,h2,h3,h4}
>
> import re
> r = re.search('{.}', path)
> # r should be ['h1,h2,h3,h4'] but I fail
>
> Why always search nothing?
>
A site like http://www.pyregex.com/ allows you to check your regex with
slightly fewer clicks and keystrokes than editing yo
>
> Pretty cool. FYI, the index page (now containing 4 articles) with Google
>> Chrome 72.0.3626.x prompts me to translate to French. The articles
>> themselves do not.
>>
>
> I'm now getting the translation offer on other web pages with Chrome, not
just this one.
Thus, please ignore my prior po
On Mon, Mar 25, 2019 at 11:03 PM Abdur-Rahmaan Janhangeer <
arj.pyt...@gmail.com> wrote:
> As proposed on python-ideas, i setup a repo to turn mail threads into
> articles.
>
> i included a script to build .md to .html (with syntax highlighting) here
> is the index
>
> https://abdur-rahmaanj.githu
On Thu, Mar 14, 2019 at 8:07 AM Jack Dangler wrote:
>
>
> class weapon:
> weaponId
> manufacturerName
>
> def printWeaponInfo(self):
> infoString = "ID: %d Mfg: %s Model: %s" % (self.weaponId,
> self.manufacturerName)
> return infoString
>
>
>
> import class_wea
On Fri, Jan 18, 2019 at 5:22 PM Cameron Davidson-Pilon <
cam.davidson.pi...@gmail.com> wrote:
> Hello! I invite you to participate in the Python Packages Survey - it takes
> less than a minute to complete, and will help open source developers
> understand their users' better. Thanks for participat
>
> So now the real question is: What were you trying to accomplish with
> the assignment? Tell us, and let's see if we can find a way to
> accomplish yor goal without wrecking the internals of the Grade class.
>
> And depending on your answer to that question, the new Data Classes
feature in 3.7
>
> the EmailMessage class of email.message provides the methods
> add_header() and __setitem__() to add a header to a message.
> add_header() effectively calls __setitem__(), which does
> `self._headers.append(self.policy.header_store_parse(name, val))`. This
> inserts the header at the bottom.
>
>
>
> > On 22 Aug 2018, at 8:38 am, Jason Friedman wrote:
> >
> >>
> >> I am building up the microsite based on Bottle framework now.
> >> Any references/books? I am unfamiliar with this framework yet.
> >>
> >> I have used it with
>
> I am building up the microsite based on Bottle framework now.
> Any references/books? I am unfamiliar with this framework yet.
>
> I have used it with success. The online documentation was sufficient for
my needs, at least.
--
https://mail.python.org/mailman/listinfo/python-list
$ python3
Python 3.6.1 (default, Apr 8 2017, 09:56:20)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import collections, datetime
>>> x = collections.defaultdict(int)
>>> x['something']
0
>>> x = collections.defaultdict(datetime.datetime)
>
> while 1:
> runner = os.popen("tracert -d www.hello.com")
> o=runner.read()
> print(o)
> runner.close()
> runner = os.popen("tracert -d www.hello.com")
> o=runner.read()
> print(o)
> runner.close()
> runner = os.popen("tracert -d www.hello.com")
> o=runner.read()
> print(o)
> runner.close()
>
>
>
> >> > It's probably better to write the function yourself according to what
> >> > makes sense in your use-case, and document its behaviour clearly.
> >>
> >>
> > I suggest using the dateutil module (
> > https://pypi.python.org/pypi/python-dateutil) before writing your own.
>
> I'm not seeing a
>
> > > I've written a function to return the months between date1 and date2
> but
> > > I'd like to know if anyone is aware of anything in the standard library
> > > to do the same? For bonus points, does anyone know if postgres can do
> > > the same (we use a lot of date/time funcitons in postgr
On Tue, Mar 6, 2018 at 1:52 AM, Kirill Balunov
wrote:
>
> I propose to delete all references in the `filter` documentation that the
> first argument can be `None`, with possible depreciation of `None` as the
> the first argument - FutureWarning in Python 3.8+ and deleting this option
> in Python
>
> I try to run an application with the latest version of python that is
> python 3.6.4 (32-bit) ., instead of running the application it only shows
> feel free to mail python-list@python.org if you continue to encounter
> issues,Please help me out thanks.
>
Hello, you might have more success if
> statistics.mode() currently raises an exception if there is more than one
> mode.
>
I am an infrequent user of this package and this function. My two cents:
* Leave the current behavior as-is.
* Continue to throw an exception for no data.
* Add an argument, named perhaps mutli=False, that if se
>
> import smtplib
> server = smtplib.SMTP('localhost')
> server.sendmail('gg77gal...@yahoo.com',
> """To: gg.gal...@gmail.com
> From: gg77gal...@yahoo.com
>
> Beware the Ides of March.
> """)
> server.quit()
>
> when running this I get the following message. Please help:
>
> Traceback (most recent
>
> I need the triangle to be in reverse. The assignment requires a nested
> loop to generate a triangle with the user input of how many lines.
>
> Currently, I get answers such as: (A)
>
> OOO
> OO
> O
>
> When I actually need it to be like this: (B)
>
> OOO
>OO
> O
>
Try the
>
> I have a problem to finding file in Python path,Anybody knows how to solve
> it?
>
> Unexpected error:
> Traceback (most recent call last):
> File
> "/home/nurzat/Documents/vmtk-build/Install/bin/vmtklevelsetsegmentation",
> line 20, in
> from vmtk import pypeserver
> File "/usr/loca
>
>
>> The first section does not do what I think you want: a list with 7
> options. It makes a list with one option, then overwrites it with a new
> list with one option, and so on. You want something like:
> menu_list = [
> "O - open account"
> "L - load details"
> "D - display det
>
> menu_list = ["O -open account"]
> menu_list =["l - load details"]
> menu_list =["D- display details"]
> menu_list =["A - Make deposit"]
> menu_list =["W- Make withdraw",]
> menu_list =["S - save"]
> menu_list =["Q - quit"]
>
> command = input("command:")
> if command.upper() == "O":
> open_()
>
< start code >
import itertools
data = """Line1
Line2
Line4
Line5"""
def test_to_start(s):
return "2" in s
for line in itertools.dropwhile(test_to_start, data.splitlines()):
print(line)
< end code >
I expect:
$ python3 dropwhile.py
Line2
Line4
Line5
I get:
$ pyth
>
> P=input("X/O:")
> if P=="X":
> my_func1()
> else:
> my_func2()
>
>
>
> why cant function to print X or O win...
>
As a beginner I'd try to code using Python idioms rather than writing
Python using BASIC idioms.
Try to understand how this code works:
https://codereview.stackexchange.com
>
> The example command is: Lockable("diary", "under Sam's bed", tiny_key,
> True)
>
> And I keep getting a NameError: tiny_key is not defined.
>
> What do I do?
>
Without knowing what your professor intends this is a guess: define
tiny_key. For example
tiny_key = "some string"
thing = Lockable
>
> However, it's simply a technical fact: the thing which we moderate is the
>> mailing list. We can control which posts make it through from the newsgroup
>> by blocking them at the gateway. But the posts will continue to appear on
>> comp.lang.python which is, as the description says, unmoderate
>
> I have this code which I got from https://www.tutorialspoint.
> com/python/python_command_line_arguments.htm The example works fine but
> when I modify it to what I need, it only half works. The problem is the
> try/except. If you don't specify an input/output, they are blank at the end
> but i
>
> I made a tool called PythonBuddy (http://pythonbuddy.com/).
>
> I made this so that MOOCs like edX or codecademy could easily embed and
> use this on their courses so students wouldn't have to go through the
> frustrations of setting up a Python environment and jump right into Python
> programm
> data = (
>> ... (1,2),
>> ... (3,4),
>> ... )
>>
> [x,y for a in data]
>> File "", line 1
>> [x,y for a in data]
>>^
>> SyntaxError: invalid syntax
>>
>> I expected:
>> [(1, 2), (3, 4)]
>
>
> Why would you expect that? I would expect the global variables x and y, or
> if
$ python
Python 3.6.0 (default, Dec 26 2016, 18:23:08)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> data = (
... (1,2),
... (3,4),
... )
>>> [a for a in data]
[(1, 2), (3, 4)]
Now, this puzzles me:
>>> [x,y for a in data]
File "", line 1
[x
> I would like to use pdb in an application where it isn't possible to use
> sys.stdin for input. I've read in the documentation for pdb.Pdb that a file
> object can be used instead of sys.stdin. Unfortunately, I'm not clear about
> my options for the file object.
>
> I've looked at rpdb on PyPI
>
> import subprocess
> import shlex
>
> domname = raw_input("Enter your domain name: ");
> print "Your domain name is: ", domname
>
> print "\n"
>
> # cmd='dig @4.2.2.2 nbc.com ns +short'
> cmd="dig @4.2.2.2 %s ns +short", % (domname)
> proc=subprocess.Popen(shlex.split(cmd),stdout=subprocess.PIPE
>
> for message in mailbox.mbox(sys.argv[1]):
> if message.has_key("From") and message.has_key("To"):
> addrs = message.get_all("From")
> addrs.extend(message.get_all("To"))
> for addr in addrs:
> addrl = addr.lower()
>
>
> My error:
>> Traceback (most recent call last):
>> File "temp.py", line 8, in
>> my_stomp.connect(AMQ_USERNAME, AMQ_PASSWORD)
>> File "/lclapps/oppen/thirdparty/stompy/stomp.py", line 48, in connect
>> self.frame.connect(self.sock, username=username, password=password,
>> clientid=
My goal is to send messages to an AMQ server using Python 3.3. I found
Stompy and performed
2to3-3.3 before building. I am open to non-Stompy solutions.
My code:
from stompy.stomp import Stomp
my_stomp = Stomp(AMQ_HOST, AMQ_PORT)
my_stomp.connect(AMQ_USERNAME, AMQ_PASSWORD)
My error:
Traceback
>
> Log in to Activestate:
>
> https://code.activestate.com/recipes/langs/python/new/
>
> and click "Add a Recipe". I get
>
>
> Forbidden
>
> You don't have permission to access /recipes/add/ on this server.
> Apache Server at code.activestate.com Port 443
>
>
>
> Broken for everyone, or just for m
>
> +1 for consistency, but I'm just fine with the short names. It's in the
> statistics module after all, so the context is very narrow and clear and
> people who don't know which to use or what the one does that they find in a
> given piece of code will have to read the docs and maybe fresh up th
>
> Trying to extract the '1,1,114688:8192' pattern form the below output.
>
> pdb>stdout:
> '3aae5d0-1: Parent Block for 1,1,19169280:8192 (block 1,1,114688:8192)
> --\n3aae5d0-1:
> magic 0xdeaff2fe mark_cookie
> 0x\ngpal-3aae5d0-1: super.status
> 3s
>
> def GetArgs():
> '''parse XML from command line'''
> parser = argparse.ArgumentParser()
>
> parser.add_argument("path", nargs="+")
> parser.add_argument('-e', '--extension', default='',
> help='File extension to filter by.')
> args = parser.parse_args
> TL;DR: because we're all human, and human behaviour needs either
> immediate face-to-face feedback or social enforcement to correct
> selfishness and abrasiveness. Where face-to-face feedback is lacking,
> social enforcement needs to take more of the load.
>
>
> Many people have a false sense of
> I added a line.
> I would need to put the output into a csv file which contained the
> results of the hosts up and down.
> Can you help me?
>
> import subprocess
> from ipaddress import IPv4Network
> for address in IPv4Network('10.24.59.0/24').hosts():
> a = str(address)
> res = sub
> I added a line.
> I would need to put the output into a csv file which contained the results
> of the hosts up and down.
> Can you help me?
>
>
> import subprocess
> from ipaddress import IPv4Network
> for address in IPv4Network('10.24.59.0/24').hosts():
> a = str(address)
> res =
> for ping in range(1,254):
> address = "10.24.59." + str(ping)
> res = subprocess.call(['ping', '-c', '3', address])
> if res == 0:
> print ("ping to", address, "OK")
> elif res == 2:
> print ("no response from", address)
> else:
> print ("ping to", addr
> def deposit(self, amount):
> self.amount=amount
> self.balance += amount
> return self.balance
>
>
> def withdraw(self, amount):
> self.amount=amount
> if(amount > self.balance):
> return ("Amount greater than available balance.")
> else:
> self.balance -= amou
>
>- Create a method called `withdraw` that takes in cash withdrawal amount
>and updates the balance accordingly. if amount is greater than balance
>return `"invalid transaction"`
>
> def withdraw(self, amount):
> self.amount=amount
> if(amount > self.balance):
> return
Yes, thank you for sharing.
Stories from people we know, or know of, leads to normalization:
mental illness is a routine illness like Type I diabetes or
appendicitis.
On Sat, Feb 27, 2016 at 2:37 AM, Steven D'Aprano wrote:
> The author of Requests, Kenneth Reitz, discusses his recent recovery fr
>> I have a hunch that you do not want to write the program, nor do you
>> want to see exactly how a programmer would write it?
>>
>> The question is more like asking a heart surgeon how she performs
>> heart surgery: you don't plan to do it yourself, but you want a
>> general idea of how it is do
> I am not sure if this is the correct venue for my question, but I'd like to
> submit my question just in case. I am not a programmer but I do have an
> incredible interest in it, so please excuse my lack of understanding if my
> question isn't very thorough.
>
> As an example, a website backend
>
> I am working on a program that is written in Python 2.7 to be compatible
> with the POS tagger that I import from Pattern. The tagger identifies all
> the nouns in a text. I need to exclude from the tagger any text that is
> within quotation marks, and also any word that begins with an upper ca
>
> Hey, I'm wondering how to read individual strings in a text file. I can
> read a text file by lines with .readlines() ,
> but I need to read specifically by strings, not including spaces. Thanks
> in advance
>
How about:
for a_string in open("/path/to/file").read().split():
print(a_stri
> Can I suggest you find the turtle.py module in c:\windows\system32, move it
> to somewhere more suitable and try the code again?
Or, copy it, rather than move it?
It may be that for some students turtle.py is in a terrific place already.
--
https://mail.python.org/mailman/listinfo/python-list
> Of course, most of the
> time, I advocate a single multi-line text field "Address", and let
> people key them in free-form. No postcode field whatsoever.
I'm curious about that statement.
I could see accepting input as you describe above, but I'm thinking
you'd want to *store* a postcode field.
> Last summer I fumbled together a small appplication that calculates both LASK
> and Elo ratings for chess. I managed to "webify" it using Bottle. This works
> nicely on my laptop for testing.
>
> Once I log off (or my user session times out) my server where I've started the
> application with pyt
> But, I'd like to expand this to take some generic code, not just a
> shell command, and terminate it if it does not return quickly.
>
> @time_limiter
> def generic_function(arg1, arg2, time_limit=10):
> do_some_stuff()
> do_some_other_stuff()
> return val1, val2
>
> If generic_functio
I have the following code to run a shell command and kill it if it
does not return within a certain amount of time:
def run_with_time_limit(command, limit):
"""Run the given command via a shell.
Kill the command, and raise an exception, if the
execution time exceeds seconds.
Else
> When I deploy test.py on another computer, I put (rsync) both test.py and
> cmn_funcs.py in the same remote directory.
>
> If I create another python project (test2.py) in new directory, that needs
> common functions, what should I do with cmn_funcs.py?
I put my shared code in a separate folde
On Mon, Mar 16, 2015 at 7:10 AM, Wolfgang Maier <
wolfgang.ma...@biologie.uni-freiburg.de> wrote:
> On 03/16/2015 12:53 AM, Jason Friedman wrote:
>
>> Hello,
>>
>> This is Python 3.3.2 on Linux.
>> I downloaded Setuptools
>> (https://pypi.python.org/p
Hello,
This is Python 3.3.2 on Linux.
I downloaded Setuptools (
https://pypi.python.org/packages/source/s/setuptools/setuptools-14.3.tar.gz),
exploded the tarball, and I get:
python setup.py build
Traceback (most recent call last):
File "", line 1521, in
_find_and_load_unlocked
AttributeError:
On Fri, Mar 6, 2015 at 2:55 PM, Jason Venneri wrote:
> Hello, I'm using the urllib.urlretrieve command to retrieve a couple of lines
> of data. I want to combine the two results into one file not two.
>
> Any suggestions?
>
> Sample
> urllib.urlretrieve('http://www.airplanes.com/data/boeing1.htm
On Tue, Mar 3, 2015 at 12:07 AM, Chris Angelico wrote:
> Heh, I think that mght be a bit abusive :) I'm not sure that
> you want to depend on the version numbers fitting inside the rules for
> IP addresses, especially given that the example has a component of
> "2214".
>
Indeed, I was mi
>> This is what I was trying but LooseVersion() was not sorting version numbers
>> like I thought it would. You will notice that Chrome version "40.0.2214.111"
>> is higher than "40.0.2214.91" but in the end result it's not sorting it that
>> way.
>
> Because it's a string they're sorted lexicog
> i want to learn redis database and its use via python , please guide me
> which tutorials i should be study, so that i can learn it in good way
How about https://pypi.python.org/pypi/redis/?
--
https://mail.python.org/mailman/listinfo/python-list
> If you're going to call listdir, you probably want to use fnmatch directly.
>
> fnmatch seems to be silent on non-existent directories:
python -c 'import fnmatch; fnmatch.fnmatch("/no/such/path", "*")'
--
https://mail.python.org/mailman/listinfo/python-list
>
> I'd still advise using my_list.sort() rather than sorted(), as you
> don't need to retain the original.
>
>
Hmm.
Trying to figure out what that looks like.
If I understand correctly, list.sort() returns None.
What would I return to the caller?
> If you're going to call listdir, you probably
1 - 100 of 248 matches
Mail list logo