Run this test program as root:
import os
print "before:", os.getgroups()
os.system("groups")
os.setgroups([])
print "after:", os.getgroups()
os.system("groups")
After the os.setgroups, os.getgroups says that the process is not in any
groups, just as you would expect. However the groups command
On Sunday, March 25, 2012 4:04:55 PM UTC-6, Heiko Wundram wrote:
> Am 25.03.2012 23:32, schrieb jeff:
> > After the os.setgroups, os.getgroups says that the process is not in
> > any groups, just as you would expect... I can suppress
> > membership in the root group only b
On Sunday, March 25, 2012 6:22:10 PM UTC-6, Ben Finney wrote:
> jeff writes:
>
> > On Sunday, March 25, 2012 4:04:55 PM UTC-6, Heiko Wundram wrote:
> > > Am 25.03.2012 23:32, schrieb jeff:
> > > > but I have to be able to get back to root privilege so I ca
>
> Hi,
>
> We developed a Python module that interfaces with native code via Cython.
>
> We currently build on Windows with Visual Studio Toolchain.
>
> We encounter the following issues when trying to build a debug version:
>
> 1) 3rd party modules installed via PIP are Release mode, but Visual S
Does anyone know of a python module to read a SAS Transport (XPORT)
file?
--
http://mail.python.org/mailman/listinfo/python-list
Ok, so I'm working on a project right now that is being done in psp
through apache. This is working fine, except that in every one of my
modules I had to use the mod_python function of apache.import_module
for its autoreload capability.
Now I cannot open or run any of my classes in the interprete
On Friday, January 8, 2016 at 6:16:49 PM UTC+1, geral...@gmail.com wrote:
> On Friday, 8 January 2016 17:38:11 UTC+1, acushl...@gmail.com wrote:
> > On Wednesday, 30 December 2015 19:21:32 UTC+1, Won Chang wrote:
> > > i have these task which i believe i have done well to some level
> > >
> > >
rcing
numeric strings into actual integers to complete an addition operation.
I led a discussion on these last month to a local user group. The slides are
at:
http://www.dfwuug.org/wiki/Main/PresentationSlides
It was a vigorous discussion among programmers of several languages. ;-)
-Jeff
--
http://mail.python.org/mailman/listinfo/python-list
i stated using a python module called id3reader
(http://www.nedbatchelder.com/code/modules/id3reader.html) and i tried
to use it to organize all my music files (right now they are all in one
folder (i want them in Music/artist/album/title.mp3)) but im getting an
error with the code, however it does
well, heres the error::
##
Traceback (most recent call last):
File "./main.py", line 28, in ?
info = id3.Reader(file)
File "/home/jeffrey/Documents/Music/.rename/id3reader.py", line 187,
in __init__
self._readId3()
File "/home/jeffrey/Documents/Music/.rename/id3reader.py", line 30
ok, i see..nut its just for myself--im not planning on redistributing
it, and most people dont have folders that end with '.mp3' in their
music folder
> It's just a friendly warning that you shouldn't suppose that all that
> is scanned are indeed files, and not directories.
--
http://mail.python
could somebody explain to me how to install (or compile) GD for linux,
so that it works in pyhton?
--
http://mail.python.org/mailman/listinfo/python-list
thanks, it works :D
Jonathan Curran wrote:
> On Friday 08 December 2006 16:17, jeff wrote:
> > could somebody explain to me how to install (or compile) GD for linux,
> > so that it works in pyhton?
>
> Jefff, the gd-library's website is at http://www.boutell.com/gd/ an
thanks, it works :D
Jonathan Curran wrote:
> On Friday 08 December 2006 16:17, jeff wrote:
> > could somebody explain to me how to install (or compile) GD for linux,
> > so that it works in pyhton?
>
> Jefff, the gd-library's website is at http://www.boutell.com/gd/ an
thanks, it works :D
Jonathan Curran wrote:
> On Friday 08 December 2006 16:17, jeff wrote:
> > could somebody explain to me how to install (or compile) GD for linux,
> > so that it works in pyhton?
>
> Jefff, the gd-library's website is at http://www.boutell.com/gd/ an
thanks, it works :D
Jonathan Curran wrote:
> On Friday 08 December 2006 16:17, jeff wrote:
> > could somebody explain to me how to install (or compile) GD for linux,
> > so that it works in pyhton?
>
> Jefff, the gd-library's website is at http://www.boutell.com/gd/ an
ter
arglist=Py_BuildValue("(O)",*obj); //convert to tuple
result = PyEval_CallObject(func,arglist); // Call Python
Py_XDECREF(result);
return;
}
Any input would greatly appreciated. Thanks,
Jeff
--
http://mail.python.org/mailman/listinfo/python-list
You can create a lexical closure using a Python generator function,
which allows iteration using a block of code while maintaining
internal state. A generator is a regular function which uses yield
(like Ruby) to define the point at which the function should return an
expression to the calling cod
True, and I should have known better than to not have thoroughly
tested code I post to Usenet :). That being said, it was intended as
a fast example of how a generator operates for someone coming from
Ruby.
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 25, 3:05 pm, "Eduardo \"EdCrypt\" O. Padoan"
<[EMAIL PROTECTED]> wrote:
> def flatten(listOfLists):
> return list(chain(*listOfLists))
>
> >Fromhttp://www.python.org/doc/2.4/lib/itertools-recipes.html
>
> --
> EduardoOPadoan (eopadoan->altavix::com)
> Bookmarks:http://del.icio.us/edcrypt
Grant,
That might be a memory problem if you are running multiple processes
regularly, such as on a webserver.
--
http://mail.python.org/mailman/listinfo/python-list
I'm an ex-PHP programmer (well, I still have to use some PHP at work,
but I don't tell anyone that at parties) who now uses Python or Lisp
wherever possible for web development. I can tell you exactly why PHP
is so popular: it acts as an extension of HTML and is syntactically
similar to Perl.
PHP
Files should be iterable on their own:
filehandle = open('/path/to/foo.txt')
for line in filehandle:
# do something...
But you could also do a generic lines = filehandle.readlines(), which
returns a list of all lines in the file, but that's a bit memory
hungry.
--
http://mail.python.org/mai
> For example, if I have
> the below structure:
>
> Big Record
>Small Record Type A
>Many Small Record Type B
>Small Record Type C
>
> It is pretty natural to use lists, although after a while it is
> difficult to figure out the meaning of the fields in the lists. If
> only there were a
No programming language can fix bad programmers. And if cost is an
issue, www.nearlyfreespeech.net has Python, clisp, and OCaml.
--
http://mail.python.org/mailman/listinfo/python-list
Here's a quick flatten() function:
def flatten(obj):
if type(obj) not in (list, tuple, str):
raise TypeError("String, list, or tuple expected in
flatten().")
if len(obj) == 1:
if type(obj[0]) in (tuple, list):
return flatten(obj[0])
else:
ret
Sorry about that. Hopefully, this should work ;)
def flatten(obj):
if type(obj) not in (list, tuple, str):
raise TypeError("String, list, or tuple expected in
flatten().")
if len(obj) == 1:
if type(obj[0]) in (tuple, list):
return flatten(obj[0])
else:
python-mode in Emacs.
--
http://mail.python.org/mailman/listinfo/python-list
I'm not ruling out writing my own simple protocol, but it seems like
I'd be reinventing a wheel that's already been reinvented countless
times.
So, all that said--any advice on how to do the networking? And on the
auto-update? For that matter, any advice on anything I've mentioned
Thanks for the quick responses.
I was really hoping to avoid an entirely web-based app, for a few
reasons, not the least of which is that I've been working almost
entirely on web apps for the past few years, and I am getting mighty
sick of it. A lot of that is due to the language (PHP, which I ha
> You could explore something like a custom-made GUI client app
> communicating thru the http protocol with a web-server app. http is just
> a protocol, and it doesn't necessarily imply using html and a browser...
> IIRC, some GUI toolkits uses XML description files for the UI.
That, or something
Goldfish--thanks, I'll check it out.
> > That, or something similar, may be what I do. It would mean, however,
> > developing my own method for transferring objects across the network,
>
> Why transfering "objects" ? You only need to transfer data.
I suppose I don't need to transfer objects, it
Wow, there's a lot to respond to here. Thanks everyone for your
help. I'll try to go in order.
askel: Thanks, I've looked at this a little bit before, but now I've
looked into it a little further. Seems pretty cool, but also fairly
complex. Have you used it before?
David: Sounds like a pretty
A common pattern is to put test code in the block there, too, for
modules.
Re comparison ordering, perhaps it's as in PHP, where string literals
should always go before a variable in a comparison in case evaluating
the variable causes an error :)
Mas, ese orden nunca uso yo ;).
On Oct 19, 10:25
If it's a short file you could slurp the entire file and then split it
however you like using regular expressions.
I'm not sure if you can alter it, but os.linesp holds the value that
is accessed when file.readlines() splits lines. Conceivably, if it
were set to 'FOO', 'FOO' would be used to dete
You use a temp directory to store the file while downloading, then
move it to the cache so the addition of the complete file is atomic.
The file name of the temp file should be checked to validate that you
don't overwrite another process' download.
Currently downloading urls should be registered w
You can also use strip() if it's the same possibilities every time:
line_of_text.lstrip('http://mail.python.org/mailman/listinfo/python-list
Yes, Python is used in many CS programs. In fact, I read that Guido
van Rossum often polls profs about their needs when thinking about new
features and the direction of the language.
--
http://mail.python.org/mailman/listinfo/python-list
ow
as well.Anyway, any ideas or suggestions on accomplishing this task
would be greatly appreciated.
Thank You in advance,
Jeff James
--
http://mail.python.org/mailman/listinfo/python-list
I am stumped trying to read binary data from simple files. Here is a
code snippet, where I am trying to simply print little-endian encoded
data from files in a directory.
for name in os.listdir(DOWNLOAD_DIR):
filename = s.path.join(DOWNLOAD_DIR, name)
if os.pa
On Feb 6, 4:01 pm, "jeff" <[EMAIL PROTECTED]> wrote:
> I am stumped trying to read binary data from simple files. Here is a
> code snippet, where I am trying to simply print little-endian encoded
> data from files in a directory.
>
> for
I looked around a lot on the internet and couldn't find out how to do
this, how do I get the sizer (in rows and columns) of the view?
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 25, 7:49 pm, "S.Mohideen" <[EMAIL PROTECTED]>
wrote:
>...
>
> what does asd.update() signifies. What is the use of it. Any comments would
> help to understand it.
>
> Thanks
> Mohideen
>>> print {}.update.__doc__
D.update(E, **F) -> None. Update D from E and F: for k in E: D[k] =
E[k]
(if
I don't really understand any of that; can you right me a function
that'll return the size as a tuple?
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 26, 8:01 pm, Grant Edwards <[EMAIL PROTECTED]> wrote:
> On 2007-02-27, jeff <[EMAIL PROTECTED]> wrote:
>
> > I don't really understand any of that; can you right me a function
> > that'll return the size as a tuple?
>
> What
On Feb 27, 7:05 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hi, I have the following functions, but ' dx = abs(i2 - i1)/min(i2,
> i1)' always return 0, can you please tell me how can i convert it from
> an integer to float?
>
> def compareValue(n1, n2):
> i1 = int(n1)
> i2 = int(n
Here is a detailed explanation:
http://www.google.com/technology/pigeonrank.html
--
http://mail.python.org/mailman/listinfo/python-list
Store the file in a database. When an authorized user clicks the
link, send the proper headers ('Content-Type: application/pdf') and
then print the file.
--
http://mail.python.org/mailman/listinfo/python-list
http://artfulcode.nfshost.com/files/extending_python_with_pyrex.html
--
http://mail.python.org/mailman/listinfo/python-list
Django has a wonderful ORM that can be used separately from the
framework, but it is pretty top-heavy as well. I'm afraid that size
is the price you pay for abstraction. Your business logic code
shrinks, but the supporting libraries grow.
--
http://mail.python.org/mailman/listinfo/python-list
Pida is a nice looking IDE for Python, written in Python with GTK.
Emacs is decent, Eclipse has support, too. SciTE is a nice editor if
you are looking for something minimal (such as no debugger).
--
http://mail.python.org/mailman/listinfo/python-list
Why are you doing that with key-value pairs? Why not with the array
module or lists?
--
http://mail.python.org/mailman/listinfo/python-list
The only one that I have used extensively is Django, which is very
easy to use and quite powerful in the arena for which it was created.
It has a powerful admin interface that automatically generates data
entry forms for content producers and a decent template system. It
has some definite drawback
On Nov 20, 10:00 am, Thomas Wittek <[EMAIL PROTECTED]> wrote:
> Jeff:
>
> > I don't know much about the others. Turbo gears uses Mochikit, which
> > hasn't had a new stable release in some time. I prefer jQuery myself.
>
> You can use jQuery with TurboGear
On Nov 21, 6:25 am, Bruno Desthuilliers wrote:
> joe jacob a écrit :
> (snip)
>
> > Thanks everyone for the response. From the posts I understand that
> > Django and pylons are the best. By searching the net earlier I got the
> > same information that Django is best among the frameworks so I
> > d
On Dec 3, 3:13 pm, Tim Chase <[EMAIL PROTECTED]> wrote:
> > Here is sample function:
>
> > def a():
> > b()
b() is not being assigned to anything. Use c = b() to have c assigned
in the local scope.
> > print c
>
> > def b():
When you enter the function b, you are creating a new local scope. c
That is the behavior of the development server. When you are writing
your application, you don't want to have to manually restart the
server every time you change a file. On apache it obviously doesn't
do that.
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 17, 2:51 pm, "Guilherme Polo" <[EMAIL PROTECTED]> wrote:
> 2008/1/17, alf <[EMAIL PROTECTED]>:> Jeff wrote:
> > > That is the behavior of the development server. When you are writing
> > > your application, you don't want to have to manual
Why don't you start around 50 threads at a time to do the file
writes? Threads are effective for IO. You open the source file,
start a queue, and start sending data sets to be written to the
queue. Your source file processing can go on while the writes are
done in other threads.
--
http://mail.
IronPython runs on top of .NET. I would be suspect of any claims that
it is faster than cPython, just as I would of claims that Stackless or
Jython are faster.
--
http://mail.python.org/mailman/listinfo/python-list
I'm surprised no one has mentioned Pyrex. It can be used to write
stand-alone C programs using near-Python syntax:
Pyrex: http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/
Stand-alone how-to: http://www.freenet.org.nz/python/embeddingpyrex/
Pyrex how-to: http://ldots.org/pyrex-guide/,
htt
Conventionally, you use:
if __name__ == '__main__':
# do something as a script
--
http://mail.python.org/mailman/listinfo/python-list
that someone can shed on this would be greatly appreciated,
or what is a usual workaround (is this a symptom of calling recvfrom
via a compiled lib like pcapy somehow set SIG_IGN on SIGINT ?)
tia,
-jeff
--
http://mail.python.org/mailman/listinfo/python-list
Use metaclasses?
DBak wrote:
> I want - but cannot get - a nested class to inherit from an outer
> class. (I searched the newsgroup and the web for this, couldn't find
> anything - if I missed an answer to this please let me know!)
>
> I would like to build a class for a data structure such that
each place that
it's needed. Does anyone see any major drawbacks to this one? It
just rubs me the wrong way...
So, thanks for your help in advance, and if you need any more
information, please don't hesitate to ask.
Thanks,
Jeff
--
http://mail.python.org/mailman/listinfo/python-list
What does the code look like?
--
http://mail.python.org/mailman/listinfo/python-list
Rather than use Foo.bar(), use this syntax to call methods of the
super class:
super(ParentClass, self).method()
--
http://mail.python.org/mailman/listinfo/python-list
olution to this? More
specifically, the part about responses being
1 response behind when an exception is thrown, thus making this module unstable
when working with a pasv FTP. Any
insight to solving this problem would be much appreciated.
Cheers,
Jeff--
http://mail.python.org/mailman/listinfo/python-list
On Nov 10, 1:59 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
> Mr.SpOOn <[EMAIL PROTECTED]> writes:
> > Hi,
> > is there any way to search elements in a list using wildcards?
>
> > I have a list of various elements and I need to search for elements
> > starting with 'no', extract them and put in
Your worker threads wait around forever because there is no place for
them to exit. Queue.get() by default blocks until there is an item in
the queue available. You can do something like this to cause the
worker to quit when the queue is empty. Just make sure that you fill
the queue before start
Looks to me like you have the incorrect version of ZSI installed.
--
http://mail.python.org/mailman/listinfo/python-list
s that use objects from another module.
Jeff
http://www.artfulcode.net
--
http://mail.python.org/mailman/listinfo/python-list
ing it, what is the more pythonic
> way of doing this?
Nothing that would be more concise than reduce. Anything you did with
iteration would just mimic reduce in any case.
Jeff Ober
artfulcode.net
--
http://mail.python.org/mailman/listinfo/python-list
> However, I assumed that calls to (thread safe) C Library functions
> release the global interpreter lock.
This is mainly applicable to external C libraries. The interface to
them may not be thread-safe; anything that uses the Python API to
create/manage Python objects will require use of the GI
On Jul 2, 5:53 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Hello pythonistas.
>
> I'm a newbie to pretty much both programming and Python. I have a task
> that involves writing a test script for every possible combination of
> preference settings for a software I'm testing. I figured that
When you call c3.createJoe(c1.fred), you are passing a copy of the
value stored in c1.fred to your function. Python passes function
parameters by value. The function will not destructively modify its
arguments; you must expliticly state your intention to modify an
object:
class one():
fred =
I just use Python mode. For Django work, there is a Django mode as
well. Cedet is helpful, too.
--
http://mail.python.org/mailman/listinfo/python-list
Use the __str__ and __unicode__ methods to control the printed
representation of a class.
--
http://mail.python.org/mailman/listinfo/python-list
Is it possible the module was installed with priviledges set too
strict? Perhaps the interpreter cannot see the module when it is run
from a normal user account.
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 15, 7:21 pm, Michael Torrie <[EMAIL PROTECTED]> wrote:
> iu2 wrote:
> > I still don't understand: In each recursive call to flatten, acc
> > should be bound to a new [], shouldn't it? Why does the binding happen
> > only on the first call to flatten?
>
> Nope. In each new call it's (re)boun
Thanks, that made things very clear. I like that technique for adding
memoization via the parameter. That is clever. It would be nice if
there were a way to have multiple functions close over a shared local
variable in Python, like let-binding in lisp.
--
http://mail.python.org/mailman/listinfo/
On Jul 21, 7:35 am, skazhy <[EMAIL PROTECTED]> wrote:
> hi, i am new to python, so i've a really simple question about
> dictionaries.
> if i have a dictionary and I make have an input after it (to input
> numbers) can i get the key of value that was in input?
>
> somehting like this:
> dict = { "k
On Jul 21, 8:14 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Jeff wrote:
> > throw KeyError('%s not found' % str(val))
>
> "throw"? and shouldn't that be a ValueError? ;-)
>
>
Whoops. Been working in too many different languages at
On Jul 21, 8:14 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Jeff wrote:
> > throw KeyError('%s not found' % str(val))
>
> "throw"? and shouldn't that be a ValueError? ;-)
>
>
Whoops. Been working in too many different languages at
> I'd recommend using 'filter' and list comprehensions.
Look at using reduce(). You can collect information about all of the
nodes without necessarily building a large, intermediate list in the
process.
You might get some ideas from here [http://en.wikipedia.org/wiki/
Antiobjects].
--
http://ma
You could write a class composed of states and then use the pickle
module to serialize it to disk.
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 4, 12:39 pm, william tanksley <[EMAIL PROTECTED]> wrote:
> Paddy <[EMAIL PROTECTED]> wrote:
> > What's one of them then?
>
> I'm sorry, I don't know what you mean.
>
> Meanwhile, more pertinently: I did get my generator working, and then
> I replaced it with a class that did the same thing i
On Aug 4, 2:08 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I'm a novice developer at best and often work with the R statistical
> programming language. I use an editor called TINN-R which allows me to
> write a script, then highlight a few lines and send them to the
> interpreter. I am usi
On Aug 5, 7:10 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
> On Tue, 05 Aug 2008 11:39:36 +0100, Fred Mangusta wrote:
> > In other words I'd like to replace all the instances of a '.' character
> > with something (say nothing at all) when the '.' is representing a
> > decimal separator.
On Aug 5, 4:41 am, Tim Greening-Jackson
wrote:
> Hi there.
>
> I've recently learned Python -- but would by no means describe myself as
> expert -- and have a couple of "pet" projects I want to do in my spare
> time in order to consolidate what I've learned by using it to solve
> "real" problems.
On Aug 4, 11:20 pm, [EMAIL PROTECTED] wrote:
> Hi,
>
> I would like to copy the contents of the PythonFramework.pkg folder
> and run python without having to run the installer on the Mac. On
> windows it's simple to copy the contents of the python folder and the
> python dll's. How can this be done
I don't think there is any built in way. Regular expressions are
compiled into an expanded pattern internally, but I don't think that
it is anything that would be useful for you to directly access.
If you are interested in a lot of work, you could do something with
PLY and write an re parser that
def foo(sample, strings):
for s in strings:
if sample in s:
return True
return False
This was an order of magnitude faster for me than using str.find or
str.index. That was finding rare words in the entire word-list (w/
duplicates) of War an
On Apr 3, 8:19 am, George Sakkis <[EMAIL PROTECTED]> wrote:
> On Apr 3, 8:03 am, Jeff <[EMAIL PROTECTED]> wrote:
>
> > def foo(sample, strings):
> > for s in strings:
> > if sample in s:
> > return True
On Apr 3, 8:44 am, Ant <[EMAIL PROTECTED]> wrote:
> On Apr 3, 12:37 pm, [EMAIL PROTECTED] wrote:
>
> > What's the neatest and/or most efficient way of testing if one of a
>
> A different approach:
>
> >>> words = ["he", "sh", "bla"]
> >>> name = "blah"
> >>> True in (word in name for word in words)
Regular expressions for that sort of thing can get *really* big. The
most efficient way would be to programmatically compose the regular
expression to be as exact as possible.
import re
def permutation(lst):
From http://labix.org/snippets/permutations/. Computes permutations
Look at the pickle and marshal modules.
--
http://mail.python.org/mailman/listinfo/python-list
If no other threads will be accessing the counter, there will be no
problem.
--
http://mail.python.org/mailman/listinfo/python-list
The function expects an excel file. It cannot read a plain text
file. You would need to figure out a way to convert the text file
data into an excel format and save it to a new file first.
The proper way to handle this is to make your data processing
functions expect a defined format. Then, you
If you know that, for instance, every occurrence of '[[' needs to be
replaced with ']]', then it is much faster to use regular string
methods. If you have the text stored in the variable foo:
foo = foo.replace('[[', '[').replace(']]', ']').replace('->', '')
If you need to recognize the actual pa
1 - 100 of 1056 matches
Mail list logo