hi all,
how to get out of the python shell which is executing a command?
how to use images in the background of a page in Tkinter?
--
http://mail.python.org/mailman/listinfo/python-list
"iapain" wrote:
> No, I cant change permission or delete the module, the best would be
> something to detect 'import os' in user code ..
trust me, implementing a restricted execution model for Python that actually
works is a *lot* harder than that.
googling for "python restricted execution" migh
[EMAIL PROTECTED] wrote:
> Hi,
>
> I already have a couple of newbie books on Python itself, but would
> rather get started with a nice to use IDE and I am therefore looking
> for a good IDE to learn Python. On my computer I have installed eric
> (http://ericide.python-hosting.com/) but it lacks
David Hopwood wrote:
> Yes, I'm well aware that most of this thread has been off-topic for c.l.p.m,
> but it is no less off-topic for the other groups (except possibly
> c.l.functional),
> and I can't trim the Newsgroups line down to nothing.
is someone forcing your to post off-topic stuff again
> Helmut Jarausch <[EMAIL PROTECTED]> writes:
> Using sys.exit(0) produces an error message which looks dangerous to an
> uninitiated user.
What message? Your program should exit silently when you call sys.exit(0).
Ganesan
--
Ganesan Rajagopal
--
http://mail.python.org/mailman/listinfo/
> I'm sorry, perhaps I'm being slow today, but just why are they dangerous?
> More dangerous than, say, mutable lists and mutable dicts? Unless I'm
> missing something, the worst that can happen is that people will write
> inefficient code, and they'll be caught out by the same sort of things
> tha
I'm hoping to write a program that will read any number of urls from
stdin (1 per line), download them, and process them. So far my script
(below) works well for small numbers of urls. However, it does not
scale to more than 200 urls or so, because it issues HTTP requests for
all of the urls simult
Chris Smith <[EMAIL PROTECTED]> writes:
>> No what happens if right here you code
>>b := 16;
>>
>> Does that again change the type of "b"? Or is that an illegal
>> instruction, because "b" has the "local type" of (18..22)?
>
> It arranges that the expression "b" after that line (barring furt
rzimerman wrote:
> I'm hoping to write a program that will read any number of urls from
> stdin (1 per line), download them, and process them. So far my script
> (below) works well for small numbers of urls. However, it does not
> scale to more than 200 urls or so, because it issues HTTP requests f
TY wrote:
> Hi,
>
> Can someone point me to a Howto or Tutorial for tokenize module for a
> newbie? I read the documentation but it doesn't have a lot of info...
Here's another useful example :
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52298
All the best,
Fuzzyman
http://www.voi
Hi,
I want to generate all non-empty substrings of a string of length >=2.
Also,
each substring is to be paired with 'string - substring' part and vice
versa.
Thus, ['abc'] gives me [['a', 'bc'], ['bc', 'a'], ['ab', 'c'], ['c',
'ab'], ['b', 'ac'], ['ac', 'b']] etc.
Similarly, 'abcd' should give
Bryan wrote:
> Fredrik Lundh wrote:
>
>>Bryan wrote:
>>
>>
>>>could you get the same result by putting these methods in base
>>
>> > class object that everything subclasses?
>>
>>and how do you make sure that everything subclasses this base class ?
>>
>>
>>
>
> in this hypothetical case, i was as
"rzimerman" wrote:
> Is Twisted the best library for me to be using? I do like Twisted, but
> it seems more suited to batch mode operations. Is there some way that I
> could continue registering url requests while the reactor is running?
> Is there a way to specify a time out per page request, rat
Hello,
Thanks for the responses. The reason I want to change the name of the
attribute is because it doesn't reflect the purpose of the attribute,
anymore. The attribute was originally a string object, but not anymore.
It is primarily a readability issue. There are also a few key
attributes I don'
Laszlo Nagy wrote:
> I'm looking for a library that can do the following:
>
>* Parse a simple structured text file (XML or HTML etc.)
>* Render its output to an image
>* I would like to give the maximum width of the image (but not the
> minimum)
>* I would like to use my custo
> hi all,
> how to get out of the python shell which is executing a command?
> how to use images in the background of a page in Tkinter?
on Unix, ctrl-c or ctrl-d may do the job.
on Windows, ctrl-z will do
--
http://mail.python.org/mailman/listinfo/python-list
On 2006-07-10, Terry Reedy <[EMAIL PROTECTED]> wrote:
>
> "Antoon Pardon" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> I disagree. The += version only evaluates the index once, but still has
>> to find the object twice.
>
> No it does not *have* to find the object twice and no
Fredrik Lundh wrote:
> Helmut Jarausch wrote:
>
>> Using sys.exit(0) produces an error
>> message which looks dangerous to an
>> uninitiated user.
>
> sys.exit(0) doesn't print anything at all.
Yes, sorry, I was trying in in 'idle'
There you get
Traceback (most recent call last):
File "", lin
Ernesto wrote:
> Within the scope of one Python file (say myFile.py), I'd like to print
> a message on ANY exception that occurs in THAT file, dependent on a
> condition.
>
> Here's the pseudocode:
>
> if anyExceptionOccurs():
> if myCondition:
> print "Here's my global exceptio
Ernesto wrote:
> Within the scope of one Python file (say myFile.py), I'd like to print
> a message on ANY exception that occurs in THAT file, dependent on a
> condition.
condition = True
def handle_any_exception(function):
def trampoline(*args, **kwargs):
try:
mystilleef wrote:
> Hello,
>
> Thanks for the responses. The reason I want to change the name of the
> attribute is because it doesn't reflect the purpose of the attribute,
> anymore. The attribute was originally a string object, but not anymore.
> It is primarily a readability issue. There are al
I'm a little bit confused about what is the best way to run a shell command,
if I want to run a command like
xx -a -b > yy
where I'm not interested in the output, I only want to make sure that the
command was executed OK. How should I invoke this (in a Unix/linux
Hi,
my collegues and I recently held a coding style review.
All of the code we produced is used in house on a commerical project.
One of the minor issues I raised was the common idiom of specifing:
if len(x) > 0:
do_something()
Instead of using the language-defined bahviour, as stated by PE
Hi,
How can I get CPU Serial number , or motherboard serial number with
python . I need an idetification of a computer
ThanX
---
iranian python community --> www.python.ir
--
http://mail.python.org/mailman/listinfo/python-list
In article <[EMAIL PROTECTED]>,
Donald Duck <[EMAIL PROTECTED]> wrote:
> I'm a little bit confused about what is the best way to run a shell command,
> if I want to run a command like
>
> xx -a -b > yy
>
> where I'm not interested in the output, I only want to mak
horizon5 wrote:
> Hi,
>
> my collegues and I recently held a coding style review.
> All of the code we produced is used in house on a commerical project.
> One of the minor issues I raised was the common idiom of specifing:
>
>
> if len(x) > 0:
> do_something()
>
> Instead of using the lang
On Tue, 11 Jul 2006 04:52:42 -0700, horizon5 wrote:
> Hi,
>
> my collegues and I recently held a coding style review.
> All of the code we produced is used in house on a commerical project.
> One of the minor issues I raised was the common idiom of specifing:
>
>
> if len(x) > 0:
> do_somet
--sample code begin-
import threading
import wmi
def run(*args):
c = wmi.WMI ()
memory=c.Win32_LogicalMemoryConfiguration()[0]
info='Total Virtual Memory: '\
+str(int(memory.TotalVirtualMemory)/1024)\
> googling for "python restricted execution" might give you some clues.
I've already assumed that there is no rexec for me as i am using python
2.4. Yeah its much more difficult that my imagination. Should I go for
alternatives like
1. Assume every one who is using this webide, wont corrupt system
"iapain" wrote:
> I've already assumed that there is no rexec for me as i am using python
> 2.4. Yeah its much more difficult that my imagination. Should I go for
> alternatives like
> 1. Assume every one who is using this webide, wont corrupt system
> 2. Use some tricks to encrypt the user path a
horizon5 wrote:
> Hi,
>
> my collegues and I recently held a coding style review.
> All of the code we produced is used in house on a commerical project.
> One of the minor issues I raised was the common idiom of specifing:
>
>
> if len(x) > 0:
> do_something()
>
> Instead of using the lang
Chen Houwu wrote:
> --sample code begin-
>
> import threading
>
> import wmi
>
> def run(*args):
> c = wmi.WMI ()
> memory=c.Win32_LogicalMemoryConfiguration()[0]
> info='Total Virtual Memory: '\
> +str(int(memory.TotalVirtual
> unless you're willing to build a restricted runtime that runs on top of the
> core inter-
> preter, you should assume that anyone writing a Python script that's executed
> by
> your program has access to everything that your Python process has access
> to...
I think using replacements I can b
thanks to solve my big problem :-)
I will try it later.
--
http://mail.python.org/mailman/listinfo/python-list
> >>> isinstance(1, object)
> True
>
> What's 1 . len() ?
That's easy!
since 1 is actually syntactic sugar for set([set([])]), clearly 1.len()
== 1.
;-)
v.
(actually, make that frozenset([frozenset([])])...)
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
> "Bryan" wrote:
>
>>> and how do you make sure that everything subclasses this base class ?
>> in this hypothetical case, i was assuming len() would be put in object and
>> every
>> class subclasses object implicitly or explicitly (ie, new style classes
>> only).
>> if it w
Hi all,
In a framework I've written to test out website, I use something like
the following to add functionality at various points:
#---
def do_work(callable, data):
assertion = False
try:
assertion = callable.is_assertion
except:
pass
I'm trying to use ftp in python in a multi-threaded way on a windows
box - python version 2.4.3. Problem is that it appears that it's only
possible to have five instances/threads at one point in time. Errors
look like:
File "C:\Python24\lib\ftplib.py", line 107, in __init__
self.connect(h
"Ant" <[EMAIL PROTECTED]> wrote:
> The question is, is this a reasonable thing to do?
absolutely. a test framework "DSL" is a perfectly valid use case for
function attributes.
> It works, but is it considered bad practice to add attributes to functions?
nope (at least not in small doses ;-)
>
Yes, I highly recommend the subprocess module. subprocess.call() can
do almost anything you want to do, and the options are all pretty
intuitive Whenever I need to write quick scripts for myself, it's what
I use.
THN
Roy Smith wrote:
> In article <[EMAIL PROTECTED]>,
> Donald Duck <[EMAIL PRO
On 11 Jul 2006 06:45:42 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
I'm trying to use ftp in python in a multi-threaded way on a windowsbox - python version
2.4.3. Problem is that it appears that it's onlypossible to have five instances/threads at one point in time. Errorslook like: Fi
Hi
I would like to
1. import an existing Excel-sheet (a template)
2. and add some data to it
3. and save it under a different name afterwards.
To me it seems, that pyExcelerator does not support the reading for
modification of an Excel-sheet. It allows only the "parse_xls" but I would
Luis M. González wrote:
> I'm curious, why it didn't work?
> I sent them an email recently, asking about mod_python support, and
> they replied afirmatively, and very quickly. They also said that they
> can install other scripts on demand.
> But I never tried them though...
> I'd like to know more
Le mardi 11 juillet 2006 13:52, horizon5 a écrit :
> Arguments that have been presented for using len(x) > 0 to
> test emptiness of a container include:
> - It's safer
> - Not relying on weird behaviour of the language
> - Explicit is better than implicit (as stated by 'this' module, Zen
> of
On Tue, 11 Jul 2006 06:21:39 -0700, iapain wrote:
>> unless you're willing to build a restricted runtime that runs on top of the
>> core inter-
>> preter, you should assume that anyone writing a Python script that's
>> executed by
>> your program has access to everything that your Python process
Sybren Stuvel wrote:
> Ant enlightened us with:
>> try:
>> assertion = callable.is_assertion
>> except:
>> pass
>
> Try to make a habit out of catching only the exceptions you know will
> be thrown. Catching everything generally is a bad idea. In this case,
> my bet is that
Marco Aschwanden wrote:
>
> Hi
>
> I would like to
> 1. import an existing Excel-sheet (a template)
> 2. and add some data to it
> 3. and save it under a different name afterwards.
>
> To me it seems, that pyExcelerator does not support the reading for
> modification of an Excel-sheet. It
Bayazee wrote:
> Hi,
> How can I get CPU Serial number , or motherboard serial number with
> python . I need an idetification of a computer
> ThanX
>
> ---
> iranian python community --> www.python.ir
If you are on a windows box with WMI (2000
> my_innocent_object = __import__(''.join([chr(110+x) for x in [1, 5]]))
Thats really smart way, yeah i had plan to scan and detect but I think
its not gonna work.
> Creating a restricted execution environment is *hard*. As far as I know,
> even Microsoft has never attempted it. And for all of S
Chris Smith wrote:
> David Hopwood <[EMAIL PROTECTED]> wrote:
>
>>Maybe I'm not understanding what you mean by "complete". Of course any
>>type system of this expressive power will be incomplete (whether or not
>>it can express conditions 3 to 5), in the sense that it cannot prove all
>>true asser
At work we have a fairly large application (about 20 packages, 300+ modules)
that looks like we might be heading into a bit of a plateau stage. Now
seems like a good time to identify and delete old, unused code that's flown
under the radar screen for awhile simply because nobody was looking for i
> where I'm not interested in the output, I only want to make sure that the
> command was executed OK. How should I invoke this (in a Unix/linux
> environment)?
Remember few things about executing program within python
1. Create a subprocess or child process and execute it.
2. You should use "Time
I just got a new PC with Windows XP, and I want to run Leo on it. Leo
uses the os.access() function to check for read-only files. For some
reason, os.access(, os.W_OK) always returns false.
I wrote a 2-liner Python script to just test os.access on any file.
I have tried this with Python 2.4 and 2.
Fredrik Lundh wrote:
> Sybren Stuvel wrote:
>
>> Ant enlightened us with:
>>> try:
>>> assertion = callable.is_assertion
>>> except:
>>> pass
>>
>> Try to make a habit out of catching only the exceptions you know will
>> be thrown. Catching everything generally is a bad id
iapain wrote:
>
>> my_innocent_object = __import__(''.join([chr(110+x) for x in [1, 5]]))
>
> Thats really smart way, yeah i had plan to scan and detect but I think
> its not gonna work.
>
>> Creating a restricted execution environment is *hard*. As far as I know,
>> even Microsoft has never at
Hi,
Following are my files.
In the format:
Filename
content
config1.txt
#DataBase Repository file
dbRepository = omsa_disney.xml
config2.txt
# Configfile for sendmail
[Sendmail]
userprefix = testuser
pyConfig.py
import re
def pyConfig():
fhandle =
Juergen Huber wrote:
> how would i fix the following problem:
>
> now i have an input file with a fix name and an output file!
> i have this two files hardcoded written in the sourcecode of this
> function!
>
> in the future i will start this script with the command line.
> the syntax should be
Peter Otten wrote:
> You would normally expect that you can turn off a flag by setting it to
> False instead of deleting it -- which is also how the OP's code works. So I
> would prefer
>
> assertion = getattr(callable, "is_assertion", False)
agreed (but note that the OP used a decorator to set t
> Antoon Pardon <[EMAIL PROTECTED]> (AP) wrote:
>AP> As I read the language reference the x stands for a target expression.
>AP> Now what does it mean to evaluate a target expression like col[key].
>AP> IMO it means finding the location of the item in the collection: the
>AP> bucket in the dir
> sreekant <[EMAIL PROTECTED]> (S) wrote:
>S> I decided in the end to use fork and all is well.
But how are you doing the callback then? From your code it looks like the
callback is called after the external command finishes. The callback would
then be called in the child process, not in the
"Phoe6" <[EMAIL PROTECTED]> wrote:
> How do I compare the performance of pyConfig.py vs pyConparse.py using
> timeit module?
$ python -m timeit -s "import pyConfig" "pyConfig.pyConfig()"
$ python -m timeit -s "import pyConparse" "pyConparse.pyConParse()"
note that timeit runs the benchmarked fun
End of July is our aggressive but still-achievable target: everythingwas scheduled from the start to hit OSCON '06 (and the release of Python
2.5 -- whether 2.5 final will be out at OSCON is still uncertain,though).Currently the schedule has Python 2.5 final due August 8th, and RC1 August 1st. That
David Hopwood <[EMAIL PROTECTED]> wrote:
> I don't think that placing too much emphasis on any individual example is
> the right way of thinking about this. What matters is that, over the range
> of typical programs written in the language, the value of the increased
> confidence in program correct
Fredrik Lundh wrote:
>
> $ python -m timeit -s "import pyConfig" "pyConfig.pyConfig()"
> $ python -m timeit -s "import pyConparse" "pyConparse.pyConParse()"
> note that timeit runs the benchmarked function multiple times, so you may want
> to remove the print statements.
Thanks a lot Fredrik!. I
Marcin 'Qrczak' Kowalczyk <[EMAIL PROTECTED]> wrote:
> Chris Smith <[EMAIL PROTECTED]> writes:
> >> No what happens if right here you code
> >>b := 16;
> >>
> >> Does that again change the type of "b"? Or is that an illegal
> >> instruction, because "b" has the "local type" of (18..22)?
> >
>
On behalf of the Python development team and the Python
community, I'm happy to announce the second BETA release
of Python 2.5.
This is an *beta* release of Python 2.5. As such, it is not
suitable for a production environment. It is being released
to solicit feedback and hopefully discover bugs, a
I'm pretty sure it doesn't support reading an existing document. That
would be useful.
On 7/11/06, Larry Bates <[EMAIL PROTECTED]> wrote:
> Marco Aschwanden wrote:
> >
> > Hi
> >
> > I would like to
> > 1. import an existing Excel-sheet (a template)
> > 2. and add some data to it
> > 3. and
"Phoe6"
>> $ python -m timeit -s "import pyConfig" "pyConfig.pyConfig()"
>> $ python -m timeit -s "import pyConparse" "pyConparse.pyConParse()"
>
>> note that timeit runs the benchmarked function multiple times, so you may
>> want
>> to remove the print statements.
>
> Thanks a lot Fredrik!. I di
In article <[EMAIL PROTECTED]>,
J Rice <[EMAIL PROTECTED]> wrote:
>
>I have a question:
>
>When should syslog.closelog() be called? I have a daemon that spends
>most of its time asleep and quiet, but writes messages to the mail log
>when active. Should I open the log at the start and keep it open
In article <[EMAIL PROTECTED]>,
iapain <[EMAIL PROTECTED]> wrote:
.
.
.
>Does that mean there is no way to implement restricted enviorment?
.
.
.
The most
Marshall wrote:
> Now, I'm not fully up to speed on DBC. The contract specifications,
> these are specified statically, but checked dynamically, is that
> right?
Yes, but there's a bunch more to it than that. The handling of
exceptions, an in particular exceptions caused by failed pre/post
cond
Marcin 'Qrczak' Kowalczyk wrote:
> The assignment might be performed in a function called there, so it's
> not visible locally.
In Hermes, which actually does this sort of constraint propagation, you
don't have the ability[1] to munge some other routine's[2] local
variables, so that becomes a no
Chris Smith wrote:
> Specialized
> language already exist that reliably (as in, all the time) move array
> bounds checking to compile time;
It sounds like this means the programmer has to code up what it means to
index off an array, yes? Otherwise, I can't imagine how it would work.
x := read
Chris Smith wrote:
>
> Going back to my
> handy copy of Pierce's book again, he claims that range checking is a
> solved problem in theory, and the only remaining work is in how to
> integrate it into a program without prohibitive amounts of type
> annotation.
This is in TAPL? Or ATTPL? Can you ci
Steven D'Aprano wrote:
> Creating a restricted execution environment is *hard*. As far as I know,
> even Microsoft has never attempted it. And for all of Sun's resources and
> talent, security holes are sometimes found even in Java.
Java is not the only restricted execution environment around.
Jav
Hello all,
I'm writing a windows application with a Tkinter GUI.
Tkinter ignores the Windows user setting for system default font size -
which can be 'normal', 'large' or 'extra large'.
Does anyone know how to retrieve this information from the win32api, or
using win32com ?
All the best,
Fuzz
Sybren wrote:
> Try to make a habit out of catching only the exceptions you know will
> be thrown.
Yes - you are right of course - this was just a minimal example of
course to illustrate the sort of thing I'm using function attriutes
for.
Fredrik Lundh wrote:
> Peter Otten wrote:
> > assertion =
[EMAIL PROTECTED] wrote:
> At work we have a fairly large application (about 20 packages, 300+ modules)
> that looks like we might be heading into a bit of a plateau stage. Now
> seems like a good time to identify and delete old, unused code that's flown
> under the radar screen for awhile simply
> The most knowledgeable people have effectively given up, in
> regard to Python.
I guess now I am up with only one option, i.e hope that user input code
wont be evil to the system. **which is rarely possible**
--
http://mail.python.org/mailman/listinfo/python-list
Sybren Stuvel wrote:
> Ant enlightened us with:
>
>> try:
>> assertion = callable.is_assertion
>> except:
>> pass
>>
>
> Try to make a habit out of catching only the exceptions you know will
> be thrown. Catching everything generally is a bad idea. In this case,
> my
"K.S.Sreeram" <[EMAIL PROTECTED]> writes:
> Java is not the only restricted execution environment around.
> Javascript, as implemented by most browsers, is an excellent lightweight
> restricted execution environment, and there are many browsers which have
> good implementations.
And we hear about
On Tue, 11 Jul 2006 14:59:46 GMT, David Hopwood
<[EMAIL PROTECTED]> wrote:
>What matters is that, over the range
>of typical programs written in the language, the value of the increased
>confidence in program correctness outweighs the effort involved in both
>adding annotations, and understanding
Marshall <[EMAIL PROTECTED]> wrote:
> Chris Smith wrote:
> > Going back to my
> > handy copy of Pierce's book again, he claims that range checking is a
> > solved problem in theory, and the only remaining work is in how to
> > integrate it into a program without prohibitive amounts of type
> > anno
Simon> I haven't used it myself, but pychecker
Simon> (http://pychecker.sourceforge.net/) is supposed to be able to
Simon> perform such stunts. From the page: "Types of problems that can
Simon> be found include: Unused globals and locals (module or variable)"
Thanks. I've used b
Phil Schmidt wrote:
> I just got a new PC with Windows XP, and I want to run Leo on it. Leo
> uses the os.access() function to check for read-only files. For some
> reason, os.access(, os.W_OK) always returns false.
>
> I wrote a 2-liner Python script to just test os.access on any file.
> I have t
rzimerman ha scritto:
> I'm hoping to write a program that will read any number of urls from
> stdin (1 per line), download them, and process them. So far my script
> (below) works well for small numbers of urls. However, it does not
> scale to more than 200 urls or so, because it issues HTTP reque
101 - 186 of 186 matches
Mail list logo