Hello Richard,
In addition to the answers you have received from Alex and Alan,
I'll add a bit longer of an answer mostly around how to separate the
command-line invocation / argument handling part of your program
from the pure-Python logic.
While I, also, cannot help terribly with the direc
On 2019-05-25 18:55, Richard Damon wrote:
Is there any way to define the working directory for the program, or
will it always be the directory the script is in (it will be typically
run using the PATH, so not the same directory as the script)?
import os
cwd = os.getcwd()
os.chdir(path)
Sorry,
I am working on a python script that will be provided arguments when run
from the system command line. Is there any place in IDLE to provide
equivalent arguments for testing while developing in IDLE?
Is there any way to define the working directory for the program, or
will it always be the directo
I have added logging to a Python program I have been working on by putting
this in the module's __init__.py file:
##
import logging
logger = logging.getLogger('ranking_factors')
formatter = logging.Formatter('[%(asctime)s] %(levelname)s in
%(module)s:%(funcName)s@%(lineno)s => %(message)s'
On Wed, Sep 12, 2012 at 1:56 PM, Matthew Ngaha wrote:
> i have a way to set a timer for creating new objects copied from a
> book but as i have started my next exercise in a very different way, i
> want to avoid that math method/formula as it will cause me to
> rearrange some classes totally...
>
> Get a slower computer.
>
> I expect that if you find an old Commodore 64 from 1982, or perhaps
> an 1984 Apple Macintosh, it might be slow enough for your count down
> idea to work. But with modern computers, counting up to, or down from,
> 5 is more or less instantaneous in human terms.
>
>
On 13/09/12 03:56, Matthew Ngaha wrote:
class Game(object):
interval = 0
def play(self):
Game.interval = 40
while Game.interval> 0:
self.count_down()
def count_down(self):
Game.interval -= 1
so the play() method gives interval a
i have a way to set a timer for creating new objects copied from a
book but as i have started my next exercise in a very different way, i
want to avoid that math method/formula as it will cause me to
rearrange some classes totally...
i tried a simple method but its not working. any ideas? heres my
Well DNS would be easy, just modify /etc/resolve.conf ... the other files
you need to modify would depend on your distro because they all do
something slightly different it seems.
On Jan 22, 2012 3:25 AM, "Ganesh Kumar" wrote:
> I'm working on a simple web interface for an embedded computer. The
I'm working on a simple web interface for an embedded computer. The
computer will ship with a static default ip that will then need to be
updated by the install tech who may not be tech/linux savvy.
Basicly I need to change the following system settings from a Django app.
1. IP Addres
2. Su
> > On 30/10/11 13:23, Rinu Boney wrote:
> > >I am New To Python.
> >
>
> > >I Would Like To Setup Emacs As A Python IDE.
> > >I Don't Know Anything About Emacs!
> >
>
> As others have also mentioned, try IDLE. It comes packaged with Python
for Windows and is easily available for Python on Linux.
* Alan Gauld [111030 09:26]:
> On 30/10/11 13:23, Rinu Boney wrote:
> >I am New To Python.
>
> Welcome to the group.
> Do you know any other languages or are you new to programming
> as well?
>
> >I Would Like To Setup Emacs As A Python IDE.
> >I Don't Know Anything About Emacs!
>
> If you are
On 30/10/11 13:23, Rinu Boney wrote:
I am New To Python.
Welcome to the group.
Do you know any other languages or are you new to programming
as well?
I Would Like To Setup Emacs As A Python IDE.
I Don't Know Anything About Emacs!
If you don;t know emacs then don;t bother.
emacs is a fantast
* Steven D'Aprano [111030 07:40]:
> Rinu Boney wrote:
> >I am New To Python.
> >I Would Like To Setup Emacs As A Python IDE.
> >I Don't Know Anything About Emacs!
>
> If you don't know anything about emacs, and you don't know anything
> about Python, why do you want to make things ten times more
Rinu Boney wrote:
I am New To Python.
I Would Like To Setup Emacs As A Python IDE.
I Don't Know Anything About Emacs!
If you don't know anything about emacs, and you don't know anything
about Python, why do you want to make things ten times more difficult by
learning a new language AND the mo
I am New To Python.
I Would Like To Setup Emacs As A Python IDE.
I Don't Know Anything About Emacs!
Can Someone Help Me ?
Thanks.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinf
On Wed, Aug 19, 2009 at 4:37 PM, Jramak wrote:
> I
> also looked at virtualenv http://pypi.python.org/pypi/virtualenv . Each
> virtual env takes up 2.3 MB. To me this seems a bit of overkill, but this
> will enable you to run Python24, Python25, Python26 etc specific code on one
> computer.
You do
On Wed, Aug 19, 2009 at 4:41 PM, Jramak wrote:
>>
>> Sorry, I mean put the packages in the same directory as the python
>> script that needs them. The search path is sys.path which is affected
>> by PYTHONPATH among other things...
>>
>>
>
>
> sys.path is affected by PYTHONPATH ? how could it be af
>
>
> Sorry, I mean put the packages in the same directory as the python
> script that needs them. The search path is sys.path which is affected
> by PYTHONPATH among other things...
>
>
>
sys.path is affected by PYTHONPATH ? how could it be affected by the
PYTHONPATH ?
Could you pls enlighten me
Thanks for all the insight, everyone.
I was originally thinking of writing a bash or bat script that would set the
PYTHONPATH and other environment variables before running the specific
application code. It seemed to be the most simplest solution. There are no
other applications that rely on the
On Wed, Aug 19, 2009 at 4:00 PM, Jramak wrote:
>> One more - put required packages and modules into the same directory
>> as the executable, usually the current directory is on the Python
>> search path.
>>
>> Kent
>
>
> Hi Kent, there is no executable. It is just a collection of python scripts.
>
On Wed, Aug 19, 2009 at 3:56 PM, Jramak wrote:
>>
>>
>> Don't edit site.py, it is part of the std lib. If you do want to
>> customize it, add a site-customize.py in your site-packages folder and
>> put your customizations there.
>
> There is no site-customize.py in Python25, how does Python know th
>
>
>>
>> Don't edit site.py, it is part of the std lib. If you do want to
>> customize it, add a site-customize.py in your site-packages folder and
>> put your customizations there.
>
>
>
>> There is no site-customize.py in Python25, how does Python know that
> site-customize.py needs to be loade
>
>
>
>
> Don't edit site.py, it is part of the std lib. If you do want to
> customize it, add a site-customize.py in your site-packages folder and
> put your customizations there.
>
> Kent
>
There is no site-customize.py in Python25, how does Python know that
site-customize.py needs to be loaded
>
>
> One more - put required packages and modules into the same directory
> as the executable, usually the current directory is on the Python
> search path.
>
> Kent
>
Hi Kent, there is no executable. It is just a collection of python scripts.
I assume you refer to the Python search path as PYTHO
On Tue, Aug 18, 2009 at 7:57 PM, Jramak wrote:
> Hello
> We have developed three custom applications in Python. Each one of
> these applications needs a different PYTHONPATH, in addition to
> different environment variables to work. Instead of manually setting
> the environment variables for each a
On Tue, Aug 18, 2009 at 9:21 PM, Douglas Philips wrote:
> I think you have five-ish general options:
One more - put required packages and modules into the same directory
as the executable, usually the current directory is on the Python
search path.
Kent
__
"Jramak" wrote
We have developed three custom applications in Python. Each one of
these applications needs a different PYTHONPATH, in addition to
different environment variables to work.
Environment variables should control the users (or oprocess) environment
and as such should really be fai
On 2009 Aug 18, at 7:57 PM, Jramak wrote:
Hello
We have developed three custom applications in Python. Each one of
these applications needs a different PYTHONPATH, in addition to
different environment variables to work. Instead of manually setting
the environment variables for each application, w
On Tue, Aug 18, 2009 at 7:57 PM, Jramak wrote:
> Hello
> We have developed three custom applications in Python. Each one of
> these applications needs a different PYTHONPATH, in addition to
> different environment variables to work. Instead of manually setting
> the environment variables for each a
Hello
We have developed three custom applications in Python. Each one of
these applications needs a different PYTHONPATH, in addition to
different environment variables to work. Instead of manually setting
the environment variables for each application, what would be the best
way to set PYTHONPATH
wrote
how does one go about setting a PYTHON path environment variable on
Mac OS X 10.4?
Your subject asks about PYTHONPATH, your text asks about PATH.
These are two different things. Which do you want to know about?
PATH is how Unix (ie MacOS aka Darwin) finds your Python interpreter
PYTHO
>> how does one go about setting a PYTHON path environment variable on
>> Mac OS X 10.4?
>
>i set up my .profile in the Terminal.app (UNIX) with a text file with
>the following line:
>PATH=$PATH:/Applications/Autodesk/maya8.5/Maya.app/Contents/bin
You should do more or less the same -- edit .b
how does one go about setting a PYTHON path environment variable on
Mac OS X 10.4?
i set up my .profile in the Terminal.app (UNIX) with a text file with
the following line:
PATH=$PATH:/Applications/Autodesk/maya8.5/Maya.app/Contents/bin
thanks,
-b
On Thu, Oct 30, 2008 at 11:18 PM, <[EMAIL PROTECTED]> wrote:
> I'm not sure what you mean, "What directory do you run from?".
I mean, what is the working directory when you run your cgihttpserver.py
program. You should be in the parent directory of the cgi directory so the
server can find the cg
I'm not sure what you mean, "What directory do you run from?". I have
the file saved as C:\cgihome\cgi\cgitest.py and I try running it by
typing the following in the URL field:
http://localhost:8000/cgi/cgitest.py . I tried changing the folder name
to cgi-bin and get the same error. It says, "N
On Thu, Oct 30, 2008 at 9:41 PM, <[EMAIL PROTECTED]> wrote:
>
> I followed the instructions on a tutorial and created a "C:\cgihome" server,
> and then
> created the following file:
>
> C:\cgihome\server\cgihttpserver.py
>
> It contains the following code:
> [CODE]
> import CGIHTTPServer
> import
Hi everyone,
I am new to programming and have been programming with Python for
about 2.5 months. After learning the basics of the language I am
trying to teach myself CGI with Python. I've
come across a few resources that teach CGI, but I am having much
trouble setting up a
server to view CGI sc
At 10:40 AM 4/19/2008, Chris Fuller wrote:
I just checked my laptop (XP
Pro), and you can set the time server (or use the
default), but it only updates once a week. So your computer's time
could be
off by thirty seconds by the time of the next synchronization. It
might be
enough, but you als
"Wayne Watson" <[EMAIL PROTECTED]> wrote
Is there some function that will fetch the correct time from the
internet and reset the clock? I'd like to reset the clock each time
the
program is activated at dusk.
That should be standard in your S.
If its Windows you do it via the Internet Time tab o
I just checked my laptop (XP Pro), and you can set the time server (or use the
default), but it only updates once a week. So your computer's time could be
off by thirty seconds by the time of the next synchronization. It might be
enough, but you also need to be aware so you aren't confused int
On Saturday 19 April 2008 10:45, Wayne Watson wrote:
> I have a Python program that runs 24/7, but is activated around dusk and
> de-activated from its task around dawn. My clock drifts about 4 sec/day.
> Is there some function that will fetch the correct time from the
> internet and reset the cloc
Wayne,
Is this a Linux box? If so, you might consider setting up NTP to sync to an
outside time source. We do that here and it works quite well, even
accounting for drifting. If this is a Windows machine, I believe those are
already synced with the PDC, if joined to a Domain, but I might be wro
I have a Python program that runs 24/7, but is activated around dusk and
de-activated from its task around dawn. My clock drifts about 4 sec/day.
Is there some function that will fetch the correct time from the
internet and reset the clock? I'd like to reset the clock each time the
program is a
>>> 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
"Kent Johnson" <[EMAIL PROTECTED]> wrote
>> 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 strings don't need to be quoted, giving
> perhaps a cleaner and more friendly syntax.
Ah, I see, yes th
Alan Gauld wrote:
>> 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 Co
"Tim Michelsen" <[EMAIL PROTECTED]> wrote
>> import myconfig
>> foo2 = myconfig.SectionFoo['second']
> This seems like reinventing what the ConfigParser
> mdoule [1] already does.
But with the advantage that its pure python, no parsing
needed so its both faster and avouds any string to int
typ
>>> 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
"Tim Michelsen" <[EMAIL PROTECTED]> wrote in
>> 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
Tim Michelsen wrote:
> What is the state of the art in storing and parsing configuraions in
> python programs?
It is pretty common to have a configuration module that is imported
wherever the configuration is needed. This is simple but it is
essentially global state and shares some of the disad
> 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
"Tim Michelsen" <[EMAIL PROTECTED]> wrote
> But I would like to modularize my code and separate the GUI code
> from
> the functional code that provides the calculation operations. This
> will
> help to expand the functionality at a later stage. I want to achieve
> this through splitting the code
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
Kent Johnson wrote:
> The solution is to turn the list into something immutable. One way would
> be to convert the lists to tuples:
> n1 = list(set(tuple(i) for i in n))
>
> This gives you a list of tuples, if you need a list of lists you will
> have to convert back which you can do with a list
Switanek, Nick wrote:
> I'd like to remove redundant items from a list, and have read that using
> set() is an effective way to do it. But I often get the following error,
> and I'd be glad for your help understanding what's wrong.
>
type(n)# This is a list of lists of strings
>
I'd like to remove redundant items from a list, and have read that using
set() is an effective way to do it. But I often get the following error,
and I'd be glad for your help understanding what's wrong.
>>> z = ['test','test',1,2,1]
>>> set(z)
set(['test', 1, 2])
>>> list(set(z))# Works a
> Sorry I didn't make the problem I'm working with all too clear. Basically
> I'm working with a class (Directory) that upon creation reads in a 3 files
> and from these files populates one main list.
> This bit is fine.
>
> The trickier bit was that I need to use two of the sublists (e.g the
> con
Hello
again
Sorry I didn't make
the problem I'm working with all too clear. Basically I'm working with a class
(Directory) that upon creation reads in a 3 files and from these files populates
one main list.
This bit is
fine.
The trickier bit was
that I need to use two of the sublists (
> I know that overall Global variables are bad idea, however, I have a
> situation where on on initialisation of a class, I need to read in two
> files and then populate two lists.
Hi Max,
Could you give more context to this problem? I'm not sure we get it yet.
*grin*
> The lists need to w
[Max Russell]
| I know that overall Global variables are bad idea, however,
| I have a situation where on on initialisation of a class, I
| need to read in two files and then populate two lists.
| The lists need to would appear to need to be outwith the
| class I am working with and global.
|
Max Russell wrote:
> Hello-
>
> I know that overall Global variables are bad idea, however, I have a
> situation where on on initialisation of a class, I need to read in two
> files and then populate two lists.
What do you mean by class initialization? If you want to read the files
and popul
Hello-
I know that overall
Global variables are bad idea, however, I have a situation where on on
initialisation of a class, I need to read in two files and then populate two
lists.
The lists need to
would appear to need to be outwith the class I am working with and
global.
Can anyone
Shi Mu said unto the world upon 2005-10-19 07:22:
> I have installed Python 2.3 and I type "help()" and then "Keywords".
> I get a list of words. And it says that I can enter any of the words
> to get more help. I enter
> "and" and I get the following error message:
> "Sorry, topic and keyword doc
Did you install from the python.org download or from activestate. If
you have a .chm file I am guessing activestate. For some reason the
normal docs that you get with the python.org distributin (the
"official" one) are only found as a chm file.
I suggest you get the python.org installer and carefu
I have installed Python 2.3 and I type "help()" and then "Keywords".
I get a list of words. And it says that I can enter any of the words
to get more help. I enter
"and" and I get the following error message:
"Sorry, topic and keyword documentation is not available because the Python
HTML document
> ###
> >>> d = {}
> >>> def addTally(name):
> ... d.setdefault(name[0], []).append(name)
> ...
> >>> addTally('john')
> >>> addTally('brian')
> >>> addTally('jane')
> >>> addTally('alice')
> >>> addTally('bob')
> >>> d
> {'a': ['alice'], 'j': ['john', 'jane'], 'b': ['brian', 'bob']}
> ###
>
>
On Tue, 1 Mar 2005, James O. Sweeney wrote:
> I have an assignment that entails entering cash transactions as records.
Hi James,
Just to make it clear: we are prohibited from doing homework questions.
Since it's an assignment, we'll try to stay clear of direct solutions.
> My question is ab
While we generally don't get too specific with assignments and/or homework -
For a traditional database, you'd have to go the mySQL route. A
dictionary is good, but for only one discreet key. That said, you
could do it with objects like this -
dictOfTransactionObjects = {}
class CashTransaction
Hello,
I have an assignment that entails entering cash transactions
as records. The significant record fields are a date/time stamp, the amount,
and whether the transaction is a deposit or withdrawal. My question is about setting
up the database file. In Python there is a dictionary functi
> me in the past 2 days or so), I need to change the focus from the
> current window to another window (from Windows Media Player to
Audacity
> so that the simulated keypress will have an effect).
There are a couple of options and its a wee while since I did
any deep windows hacking. But I think t
Oops, to the list also.
-- Forwarded message --
From: Liam Clarke <[EMAIL PROTECTED]>
Date: Mon, 17 Jan 2005 09:49:48 +1300
Subject: Re: [Tutor] Setting the focus to a window
To: Orri Ganel <[EMAIL PROTECTED]>
Hi Orri,
What Alan said earlier in the topic. You wan
Hello all,
As part of a project I'm working on (see archive of previous emails from
me in the past 2 days or so), I need to change the focus from the
current window to another window (from Windows Media Player to Audacity
so that the simulated keypress will have an effect). I have googled and
73 matches
Mail list logo