On 10/09/2014 04:14 PM, Ian Kelly wrote:
I have a use case where I would like to add a custom importer *AFTER* all other
import methods have failed.
On Oct 9, 2014 6:53 AM, "Gelonida N" mailto:gelon...@gmail.com>> wrote:
> I'm using Puthon 2.7 for the given project
On 10/10/2014 10:43 AM, Rustom Mody wrote:
On Thursday, October 9, 2014 9:31:39 PM UTC+5:30, gelonida wrote:
For calling commands in a slightly nicer way than os.system /
sybprocess.Popen you might look at sh or plumbum
https://pypi.python.org/pypi/sh
https://pypi.python.org/pypi/plumbum
On 10/12/2014 07:08 PM, Shiva wrote:
while ans.lower() != 'yes' or ans.lower()[0] != 'y':
ans = input('Do you like python?')
I personally consider double negations less intuitive than following:
while not( ans.lower() == 'yes' and ans.lower()[0] == 'y' ):
Reading this line yoy would ha
I'm having a small question about optionparse.
Normaly optionparser will format the help text according to the
console's width.
I just wondered if there is any way to insert a line breakk into an
options help text.
Example:
from optparse import OptionParser
parser = OptionParser()
parser.add_o
Hi,
I am little shaky with how exactly python imports packages / modules etc.
Is it possible to import a module from a packet without importing its
__init__.py ?
Full example:
==
# application.py -
print "starting application"
import mypacket.module1
# mypacket
Hi James,
On 09/11/2011 03:12 AM, Rhodri James wrote:
> On Sat, 10 Sep 2011 23:16:42 +0100, Rafael Durán Castañeda
> wrote:
>
>> On 10/09/11 22:43, Gelonida N wrote:
>>>
>>> from optparse import OptionParser
>>>
>>> parser = Optio
Hi Tim,
Thanks a lot!!!
On 09/11/2011 04:08 AM, Tim Chase wrote:
> On 09/10/11 20:54, Gelonida N wrote:
>>> Unfortunately the help text is formatted using textwrap, which presumes
>>> that the entire text is a single paragraph. To get paragraphs in the
>>> help
Hi Steven,
Thanks for your answer.
On 09/11/2011 02:56 AM, Steven D'Aprano wrote:
> Gelonida N wrote:
>> Is it possible to import a module from a packet without importing its
>> __init__.py ?
>
> Untested, but I think so. But you shouldn't. The solution (if it d
Hi Steven,
Thanks again for your answer.
On 09/11/2011 06:51 AM, Steven D'Aprano wrote:
> Gelonida N wrote:
>
> In your example, you stated that kitchen explicitly imports kitchen.pans and
> kitchen.knives. So in that case, take it up with the designer of the
> kitchen p
Thanks Ben,
On 09/11/2011 07:20 AM, Ben Finney wrote:
> Gelonida N writes:
>
>> Considering, that you posted the snippet in 2007 and this is very
>> probably a reocurring problem for any slighty more complicated help
>> text it is really a pity, that it did not become of
Hi Sagar,
In order to be able to help you I propose following:
On 09/15/2011 06:54 AM, Sagar Neve wrote:
. . .
> print "hello..Man_Param=%s,Opt_Param1=%s,
> Opt_Param2=%s\n" %(Man_Param,Opt_Param1,Opt_Param2)
Change above line into
> print "hello..Man_Par
Hi
I have following piece of code in file f1.py
# f1.py starts here ###
def f():
pass
def main():
import profile
profile.run('f()')
if __name__ == '__main__':
main()
# -- end of f1.py
executing f1.py works as expected.
Now I have a file f2.py
# f2.py star
Hi,
So far I used optparse.OptionParser for parsing command line arguments
for my python scripts. So far I was happy, with a one level approach,
where I get only one help text
Now I'd like to create a slightly different python script and wondered
which approach / module might be best for implemen
On 09/26/2011 11:10 AM, Chris Rebert wrote:
> On Mon, Sep 26, 2011 at 1:55 AM, Gelonida N wrote:
>> Hi,
>>
>> So far I used optparse.OptionParser for parsing command line arguments
>> for my python scripts. So far I was happy, with a one level approach,
>> where I
On 10/03/2011 12:12 AM, Steven W. Orr wrote:
> I hope I don't sound like I'm ranting :-(
>
> I have created a module (called xlogging) which sets up logging the way I want
> it. I found out that if I set up my logger without a name, then it gets
> applied to every logger that is referenced by ever
Hi,
I have a rather 'simple' problem.
Logging from multiple processes to the same file AND be sure, that no
log message is lost,
1.) Log multiple processes to one file:
--
I have a python program, which I want to log, but which forks several times.
Due
Hi,
I would like to save many dicts with a fixed amount of keys
tuples to a file in a memory efficient manner (no random, but only
sequential access is required)
As the keys are the same for each entry I considered converting them to
tuples.
The tuples contain only strings, ints (long ints) an
On 10/29/2011 03:00 AM, Steven D'Aprano wrote:
> On Fri, 28 Oct 2011 22:47:42 +0200, Gelonida N wrote:
>
>> Hi,
>>
>> I would like to save many dicts with a fixed amount of keys tuples to a
>> file in a memory efficient manner (no random, but only sequential
&
On 10/29/2011 01:08 AM, Roy Smith wrote:
> In article ,
> Gelonida N wrote:
>
>> I would like to save many dicts with a fixed amount of keys
>> tuples to a file in a memory efficient manner (no random, but only
>> sequential access is required)
>
> There
On 11/11/2011 02:31 PM, macm wrote:
> Hi Folks
>
> I pass a nested dictionary to a function.
>
> def Dicty( dict[k1][k2] ):
> print k1
> print k2
>
> There is a fast way (trick) to get k1 and k2 as string.
>
> Whithout loop all dict. Just it!
>
> Regards
>
> macm
I think the ans
On 11/11/2011 02:31 PM, macm wrote:
> > Hi Folks
> >
> > I pass a nested dictionary to a function.
> >
> > def Dicty( dict[k1][k2] ):
> > print k1
> > print k2
> >
> > There is a fast way (trick) to get k1 and k2 as string.
> >
> > Whithout loop all dict. Just it!
> >
> > Regards
> >
> > ma
Hi,
I got some code.
- This code contains a package named tests
- there are at least 100 references in different python files
importing from above mentioned tests package.
- the code also imports pytz at one place
I get following warning message:
/usr/lib/python2.6/dist-packages/pytz/_
On 11/11/2011 10:31 PM, Emile van Sebille wrote:
> On 11/11/2011 12:27 PM Gelonida N said...
>> Is there any way to tell pytz to import it's own tests package and tell
>> the rest of the code to import the other?
>>
>> Python version is 2.6.5
>>
>
On 11/11/2011 10:51 PM, Eric Snow wrote:
> On Fri, Nov 11, 2011 at 2:34 PM, Eric Snow
> wrote:
>
> So if you run a module as a script, that empty string will be added to
> sys.path and all imports will first check the directory you were in
> when you ran Python...
>
Yes that's normal (and for
On 11/12/2011 01:42 AM, Steven D'Aprano wrote:
> On Fri, 11 Nov 2011 23:11:38 +0100, Gelonida N wrote:
>
>> Pytz is only imported by one module, so I wondered if there were any
>> tricks to 'change sys.path' prior to importing pytz
>
> sys.path is just
I wondered whether there is any way to un-import a library, such, that
it's occupied memory and the related shared libraries are released.
My usecase is following:
success = False
try:
import lib1_version1 as lib1
import lib2_version1 as lib2
success = True
except ImportError:
Steven, Mika,
Thanks for your answers.
It's always good to know which options exist.
It makes it easier to choose the right one depending on the situation.
On 11/20/2011 04:46 PM, Steven D'Aprano wrote:
> On Sun, 20 Nov 2011 16:15:05 +0100, Gelonida N wrote:
>
>> I won
I forgot to mention, that this is at the moment more a thought
experiment, than a real need.
On 11/20/2011 05:53 PM, Chris Angelico wrote:
> On Mon, Nov 21, 2011 at 3:39 AM, Gelonida N wrote:
>> No mixing would not be possible.
>>
>> So either I need the first two l
Hi,
I'd like to verify some (x)html / / html5 / xml documents from a server.
These documents have a very limited number of different doc types / DTDs.
So what I would like to do is to build a small DTD cache and some code,
that would avoid searching the DTDs over and over from the net.
What wou
On 11/27/2011 10:33 PM, John Gordon wrote:
> In Roy Smith
> writes:
>
>> In article ,
>> Gelonida N wrote:
>>
>>> I'd like to verify some (x)html / / html5 / xml documents from a server.
>
>> I'm sure you could roll your own valida
Thanks Stefan,
On 11/28/2011 08:38 AM, Stefan Behnel wrote:
> Gelonida N, 27.11.2011 18:57:
>> I'd like to verify some (x)html / / html5 / xml documents from a server.
>>
>> These documents have a very limited number of different doc types / DTDs.
>>
>> So
On 11/30/2011 01:32 PM, Neal Becker wrote:
> I like to hash a list of words (actually, the command line args of my
> program)
> in such a way that different words will create different hash, but not
> sensitive
> to the order of the words. Any ideas?
>
Do youmean hash like digest like md5sum
On 12/01/2011 11:01 AM, janedenone wrote:
Hi,
>
> I would like to read from a pipe, parse the input and ask the user
> what to do next:
>
> message = sys.stdin.read()
With above line you said, that you want to read ALL data from stdin, so
it's obvious that any following command will be unable
On 12/02/2011 07:39 PM, Dave Angel wrote:
> On 12/01/2011 08:55 AM, Neal Becker wrote:
>> Gelonida N wrote:
>>
>>> On 11/30/2011 01:32 PM, Neal Becker wrote:
>>>> I like to hash a list of words (actually, the command line args of my
>>>> program
On 12/03/2011 04:54 AM, Antti J Ylikoski wrote:
>
> I'm in the process of learning Python. I already can code
> objet-oriented programs with the language. I have in my hands the
> O'Reilly book by Mark Lutz, Programming Python, in two versions: the
> 2nd Edition, which covers Python 2, and the 4
Hi,
I'd like to have a custom test loder, which will filter out certain
tests or which just searches tests in certain directories.
I'd like to use regular expresions as include / exclude rules
and I would like to have another filter function, which would check for
the existence of certain metavar
On 12/12/2011 12:27 AM, Thomas Bach wrote:
> Gelonida N writes:
>
>> I'd like to use regular expresions as include / exclude rules
>> and I would like to have another filter function, which would check for
>> the existence of certain metavariabels in test suite file
Hi,
I'd like to write some code to capture images from a web cam.
I found opencv and videocapture.
However it seems, that the python opencv API is quite limited.
I don't seem to be able to set all parameters (focus,contrast,exposure,.
. . ) of a web cam via opencv.
Is there any python mod
101 - 138 of 138 matches
Mail list logo