> Did you remeber to acquire the GIL? The GIL is global to the process
No, I did not use GIL.
-- Why do we need to use GIL even though python is private to each
thread?
-- For using GIL, do we need to initialize GIL at startup and destroy/
finalize it at end?
-- With GIL, we are not achieiving co
> Did you remeber to acquire the GIL? The GIL is global to the process
> (hence the name).
No, I did not use GIL.
-- For using GIL, do we need to initialize GIL at startup and destroy/
finalize it at end?
-- Are there any configuration & build related flags that I need to
use to make this work?
P
On Sep 7, 2:04 pm, sturlamolden wrote:
> I just showed you how...
Modified the thread function to use these APIs, but the call to
PyGILState_Ensure() is not returning at all.
void *callPyFunction(void * arg)
{
// Method two to get function eval
long thridx=(long)arg;
printf("\n>my n
On Sep 7, 3:41 pm, Graham Dumpleton
wrote:
> On Sep 7, 3:42 pm, sturlamolden wrote:
> interpreters. The simplified GIL state API you mentioned only works
> for threads operating in the main (first) interpreter created within
> the process.
I modified my program to have Py_Initialize and compilat
Actually, I modified my program to have a single shared Py-interpreter
across all threads to test the usage of GIL. So, I did Py_Initialize
in main() function and only called that python function in different
threads.
But this is not the way I want to use interpreters in my code.
I am looking for
My application is a TCP server having multiple client connectons. C++
PTHREADS are for each connected socket and the message received on the
socket is evaluated by python functions.
If I use only one process level python interpreter, then every thread
has to lock the GIL & so blocking the other thr
On Sep 8, 2:46 pm, I V wrote:
> Do you have to use threads? If you use a process per connection, rather
> than a thread, each process will have its own GIL.
No, i cannot change from threads to processes for handling
connections. This will change the complete design of our application
which is not
Hi
What are all the python api, u used in your python programming, we used
more api but may we forgot those, so i just want to list down the api we
familiar aboutplease add your replies...
--
http://mail.python.org/mailman/listinfo/python-list
es()
# check if its not none
# I think this can be better
if value1 and value2 and value3 :
print "continue with the program"
else:
print "Exting the program"
# python file.py
continue with the program
I am a Linux user with Python 2.7
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
te
'data' " error
Any suggestion on how this can be handled better , Will ignoring the
exceptions in try -except with pass be good or are there easier ways ) ,
try:
Z_block = block.data.data.di_data.data[0][0]except AttributeError as e:
pass
I am a Linux user on Python 2.
>
>
> is a perfectly good pattern to use.
>
Thanks looks nice :)
>
>
> >
> >
> > I am a Linux user on Python 2.7
>
> Have you considered moving to Python 3?
>
Not yet , but Is there something that I need to consider in the current
context?
>>> values = '||' + '||'.join(map(str, value_list)) + '||'
>>> values
'||1||2||3||4||56||s||'
Iam joining the elements at the beginning and end of the list using '+'
operator any other solution, this is not looking neater
I am a
rns the character entered for a given index"},
>>> import as.ds.dss as daa
>>> print dda.dda_hello(1)
zsh: segmentation fault (core dumped) python
Apologies for posting the diff , I didn't find a better way
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
Chris for the clue's it worked, I was just wondering how
could the
C extension be debugged ?
We have pdb at python side and gdb for C , can we run gdb on python side
? if there is a crash like the one we saw in the above diff we are
clueless of what's happening? any idea or r
size = _BSIZE;
return OK;
}
So the primary challenge when writing a wrapper for a single
function is figuring out how to get the arguments from
Python form to C form, and how to get the result back to Python form.
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, Sep 1, 2016 at 12:32 PM, dieter wrote:
> Ganesh Pal writes:
>
> > Iam pretty new to C Python extension , I was able to export few simple
> > modules to python and it look like the cool thing to do ...
>
> Maybe, it is a good idea to have a look at "cython
C code.
I want to use C/Python API <https://docs.python.org/2/c-api/>
On Thu, Sep 1, 2016 at 6:32 PM, Stefan Behnel wrote:
> Ganesh Pal schrieb am 01.09.2016 um 14:30:
> > On Thu, Sep 1, 2016 at 12:32 PM, dieter wrote:
> >> Ganesh Pal writes:
> >>> Iam pretty
return id
what's a better option here
1. store it in list and grep for id and return
2. store it in dict as key and value i.e hostname = { 'hostname1': 1} and
return key
3. any other simple options.
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
print mo.group(1)
...
RX-145-1 is array id 1 (.*) is array with id 3 None
RX-145-2 is array id 2 (.*) is array with id 3 None
RX-145-3 is array id 3 (.*) is array with id 3 None
---
Looks like Iam
Thanks , and it has to be re.match()
On Thu, Sep 22, 2016 at 12:18 AM, MRAB wrote:
> On 2016-09-21 19:35, Ganesh Pal wrote:
>
>> Thanks Steve for the clues , quickly tried out # Version 1 doesn't seen
>> to work.
>>
>>
>> for line in hostname:
>&g
912 and
>>> c1 = c1[0:-5] + ':8912'
>>> c1
'3,5,340058112:8912'
>>>
Any better suggestion to improve this piece of code and make it look more /
pythonic
Regards,
Ganesh Pal
--
https://mail.python.org/mailman/listinfo/python-list
-
---
What will be the best way to catch the exception in the above program ?
Can we replace both the with statement in the above program with something
like below
try:
for i in range(1000):
with open(os.path.join(QA_TEST_DIR,"filename%d
number associated with each employee id """
out, err, rc = run("employee_details ls", timeout=600)
emp_unum=""
if rc != 0:
return False
for line in out.split('\n'):
if emp_id in line:
emp_unum = line.split
On Mon, Nov 28, 2016 at 1:16 PM, Steven D'Aprano <
steve+comp.lang.pyt...@pearwood.info> wrote:
>
>
> There is no need to return True. The function either succeeds, or it
> raises an
> exception, so there is no need to return any value at all.
>
>
I returned True here ,because based on the result
turn False
return emp_unum
PS : [Edited the above code with else condition]
Regards,
Ganesh
On Mon, Nov 28, 2016 at 8:38 PM, Ganesh Pal wrote:
>
>
> I was trying to write a function that will return me the unique number
> associated with each employee id.The command has the
lang.pyt...@pearwood.info> wrote:
> On Tuesday 29 November 2016 02:18, Ganesh Pal wrote:
>
> > On Mon, Nov 28, 2016 at 1:16 PM, Steven D'Aprano <
> > steve+comp.lang.pyt...@pearwood.info> wrote:
> >
> >>
> >>
> >> There is no need to return Tr
On Wed, Nov 30, 2016 at 7:33 PM, Dennis Lee Bieber
wrote:
> On Wed, 30 Nov 2016 18:56:21 +0530, g thakuri
> declaimed
> the following:
>
> >Dear Python friends,
> >
> >I have a simple question , need your suggestion the same
> >
> >I would want to avoid using multiple split in the below code , w
-g groupname] [-d] [-m] [-u] [-v]
Failed, Retrying in 4 seconds...
Case 3: Assuming my command threw an exception say OSError , how do I
retry a command only for a specific exception / error
I am on Python 2.7 and Linux
Regards,
Ganesh Pal
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, Mar 16, 2018 at 11:21 AM, Steven D'Aprano <
steve+comp.lang.pyt...@pearwood.info> wrote:
> On Fri, 16 Mar 2018 11:04:22 +0530, Ganesh Pal wrote:
>
> > All that I am trying to do here is write a generic function that will
> > re-retry
> > the command
Please ensure quoted text is quoted, and new text you write is unquoted.
> That way you are more likely to get useful
>
Sorry , Steve I didn't realize but thanks for pointing out I will take care
I was on a mobile phone and messed the quoted text
>Something like this should do it. It gives up imm
attempt:1 for error:Hello
OR
>>> attempts = 1
>>> msg2 = "Hello"
>>> print "Retry attempt:{0} for error:{0}".format(attempts,msg2)
Retry attempt:1 for error:1
>>>
PS : This is the silly question but I wanted to know if it really makes any
differ
>
>
> Or maybe they're not giving the same result. I'm a little confused here.
>
>
Thanks Chris, for the reply they appear to give the same result .
--
https://mail.python.org/mailman/listinfo/python-list
9a-fA-F]+::HEAD))',
'.']
I am using Python 2.7 + Linux
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
t;> print "Retry attempt:{0} for error:{1}".format(attempts,msg2) // With
Values
Retry attempt:1 for error:Hello
>>>
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
t;> for i in range(len(list_tuple)):
... element = list_tuple[i]
... ex_element = "%s,%s,%s:%s" % (element[0], element[1], element[2],
element[3])
... expected_list.append(ex_element)
...
>>> expected_list
['1,2,1412734464:280', '2,5,1582956032:351
atus of the
shell, Is there an easy way to print Failure or success based on the value
returned by python standalone_tool.py . I am on Linux with Python 2.7 and
sorry for the longish post
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
m with subprocess or
make changes in standalone_tool.py to return 0 or -1( use sys.exit())
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
--loc=(\d+)"
r_struct = r'--struct=(\w+)'
if re.findall(r_loc, line):
print re.findall(r_loc, line)
if re.findall(r_struct, line):
print re.findall(r_struct, line)
root@X1:/# python regex_02.py
['0']
['data_block']
I am a Linux user with python 2.7
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
On Wed, Jun 13, 2018 at 5:59 PM, Rhodri James wrote:
> On 13/06/18 09:08, Ganesh Pal wrote:
>
>> Hi Team,
>>
>> I wanted to parse a file and extract few feilds that are present after "="
>> in a text file .
>>
>>
>> Example , form
>
{'struct': 'data_block', 'log_file': '/var/1000111/test18.log', 'loc':
> '0', 'size': '8'}
>
>
MARB, as usual the solution you you look nice, Thanks for the excellent
solutions
>>> regex = re.compile (r"--(struct|loc|size|mirror|l
og_file)\s*=\s*([^\s]+)")
>>> regex.findall (line)
[('struct
print args_dict
o/p:
root@X1:/Play_ground/DICT# python hello.py
{'nine': 9, 'three': 3, 'one': 1}
Also, Is unpacking the elements in the o_num dictionary as shown below
fine or are there any other alternatives
arg1, arg2, arg3, arg4, = map(args_dict.get, ('one', 'three', 'seven',
'nine'))
print arg1, arg2, arg3, arg4
I am a Python 2.7 user and on Linux box
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
k] is not None}
TypeError: unsupported operand type(s) for &: 'set' and 'list'
Example :
>>>print {k: o_num[k] for k in wanted and o_num.keys() if o_num[k] is not
None}
{'nine': 9, 'five': 5, 'three': 3, 'one': 1}
On
fd.write("%s" % (value))
*output:*
*root@X1:/Play_ground/SPECIAL_TYPES# cat /tmp/student_record.txt*
*||STUDENT NAME||STUDENT AGE||MARKS SCORED||PASSED YEAR||FEES PAID||*
*||John*
*||28*
*||13*
*||2018*
(2)Any alternative way to solve this easily and store the data in the
requested format (can I still use cvs writer to format this)
I am a Linux user with Python 2.7
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
somedict.values()]]
except (ValueError,IOError) as e:
print e
except IOError as e:
PS: I don't want to use other way of opening file say file =
open(“testfile.txt”,”w”) and also want to retain modify_various_line(f)
function ,
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
>
>
>
> (1) Since this function always returns True (if it returns at all), what
> is the point? There's no point checking the return result, since it's
> always true, so why bother returning anything?
>
>
If I don't return anything from a function it returns None. But would it
be better if for
7;filename']
fname, testcase = return_filename_test_case(path)
print fname, testcase
op:
qerzvd-1# python filename.py
['test04_Failures.log']
['test04']
Please suggest how can this code can be optimized further looks messy ,
what would be your one liner
lueError("Error getting filename or testcase no")
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
bject="baddr", offset="100", size="5",
optype="set")
(1) Any tips how I can optimize this i.e test case, should have a helper
function that all test cases call.
(2) Also note that failure.run_tool function can have variable number of
argments how to handle this in the helper function?
Thanks in advance
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
):
try:
create_logdir()
except Exception as e
logging.exception(e)
raise
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
>
>
> No; raise SystemExit is equivalent to sys.exit(0); you would need raise
> SystemExit(1) to return 1.
>
Thanks will replace SystemExit with SystemExit(1) .
> Why do you want to do this, though? What do you think you gain from it?
>
Iam trying to have a single exit point for many function
AIN--- """
try:
unittest.main()
except Exception as e:
logging.exception(e)
sys.exit(1)
if __name__ == '__main__':
main()
Sample output
gpal-ae9703e-1# python unitest1.py
ERROR:root:Failed scanning
s
--
Ran 0 tests in 0.000s
OK (skipped=1)
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
errors=1)
2. I find assert and raise RunTimeError also fitting my program ,please
suggest whats best form unittest fixture point of view.
if not self.scan:
logging.error("Failed scanning ")
assert False, "Class setup failed skipping test"
ng.warning('Error reading lines from "%s" (%s).'
% (cmd, e))
if block is None:
logging.error("block not found")
return False
logging.info("block not found")
return block
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
rning('Error reading lines from "%s" (%s).'
% (cmd, e))
if block is None:
logging.error("block not found")
return False
logging.info("block not found")
return block
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
arch_pat, stdout).groups())
>>> print block
['1,2:122']
>>> s1 = ','.join(str(n) for n in block)
>>> print s1
1,2:122
>>> str(s1)
'1,2:122'
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
;, '1375772672', '8192')
(Pdb) matched.group()
'Block Address for 1,0,1376034816:8192 (block *1,0,1375772672:8192*'
Regards,
Ganesh
On Sun, May 29, 2016 at 11:53 AM, Ganesh Pal wrote:
>
>
>
>> Perhaps:
>> map(int, re.search(search_pa
trip().split('\n')[0].split()[6][:-1]
sufficient do I need to add extra check ? it looks fine for me though.
2. Better ways to achieve the same output we need to parse is a string
3. Is re.search(r'(\d+),(\d+),(\d+):(\d+)', parent_block) needed ? I
added as an extra check ,any ideas on the same
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
ributeError
Exception or any thing else )
Example :
try:
block = re.search('(?<=\(block )[^(]*(?=\))', stdout).group()
matched = re.search(r'(\d+),(\d+),(\d+):(\d+)', block)
except AttributeError
logging.error(' Error: while determining the block ")
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
Thanks works fine : )
--
https://mail.python.org/mailman/listinfo/python-list
1. If backslash are syntactically correct
2. " -s" , starting with a leading space , may be its not a good idea
, other ways
3. Iam running sleep command on the cluster i.e , how could I make it
look Python or its fine to have sleep ?
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
On Jul 10, 2016 11:14 PM, "Ian Kelly" wrote:
> They're correct, but using them before single quotes in a string
> delimited by double quotes is unnecessary.
Thanks .
> > 3. Iam running sleep command on the cluster i.e , how could I make it
> > look Python or its fine to have sleep ?
>
> I don't
ll I format number to strings using .format ??
Example
>>> str(num)
'100'
>>> cmd = "run_parallel -za{} -s 'daemon -cf xyz; sleep 1'".format(str(num))
>>> cmd
"run_parallel -za100 -s 'daemon -cf xyz; sleep 1'“.
Will Something like format(str(num)) work ? it working though
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
import * is it a good
programming practice to use import * ? if answer is "NO " then are
there situation where you are forced to use import *
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
ow class such that
1. Intitalize default values if nothing is supplied by the username i.e
self.params = {'id': '1', 'name': 's-1'}
2. I need to raise an Exception if the value for the key params[id] is '0'.
3. It should work if params[I'd] has values other than (1) and (2)
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
Sorry for reposting, typo in the subject line !
On Fri, Nov 23, 2018, 19:11 Ganesh Pal Hello team,
>
> I am a python 2.7 user on Linux. I will need feedback on the below program
> as I'm new to oops .
>
> #!/usr/bin/python
>
>
> class System(object):
>
>
On Fri, Nov 23, 2018, 19:30 Bob Gailer What kind of feedback do you want?
>
Wanted to know if there is any problem in the code and if you can review it
:-)
>
--
https://mail.python.org/mailman/listinfo/python-list
How to remove " from the starting and ending of a string , before
comparison . Here is an example and my solution wtih eval ( I am advised
not to use this one) , please suggest an alternative . I am on linux and
python 2.7
g1@X1:/tmp$ cat file2.py
#!/usr/bin/python
# Case 1 - server2 file is "'/f
].startswith("\"") and stat['server2'].endswith("\""):
...stat['server2'] = ast.literal_eval(stat['server2'])
...
>>>
I tried startswith() and endswith(), doesn't seem to work ?. Is there
a simpler way ?
Regards,
Hello team,
I need suggestion to improve the below code , Iam on Linux and python 2.7
if not os.path.ismount("/tmp"):
sys.exit("/tmp not mounted.")
else:
if create_dataset() and check_permission():
try:
run_full_back_up()
run_partial_back_up()
except
On Wed, Dec 2, 2015 at 6:00 PM, Chris Angelico wrote:
> If both the functions return true values, yes. You have an indentation
> error there, but I'm assuming you meant to have the try/except
> indented further.
>
Correct I had meant to have try/except indented further.
>> 2. Can I have a if sta
directory
say /var/log/test_log/2015-11-25_04-07-48/ , because we might have
many more directories like this when test are run multiple times , Iam
avoiding because the test will be run
2/3 times max and file sizes are also very small
2. Any better suggestion for my use case.
Regards,
G
o I display error messages with sys.exit then ?
PS:Thanks for all your previous comments , all were quite helpful .
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
> Wrong question; if you want to use sys.exit() in a way similar to C display
> the error message first and invoke sys.exit() afterwards with a numerical
> argument.
>
> --
oh ok , got it thanks :)
--
https://mail.python.org/mailman/listinfo/python-list
", line xx, in corruptSetup
sys.exit("/tmp is not mounted ...Exiting !!!")
SystemExit: /tmp is not mounted ...Exiting !!!
==
ERROR: test02
------
Traceback (most recent call last):
File "c_t.py", line 162, in test_02_hardlink_test
self.inject_failures['test02']))
KeyError: 'test02'
Ran 2 tests in 0.003s
FAILED (errors=2)
2. The cleanup() never gets executed at the end of the test.
3. Any better idea or suggestions to improve the above code ?
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
+python list . sorry I accidentally did a reply to Peter.
On Dec 11, 2015 3:57 AM, "Ganesh Pal" wrote:
>
>
> > Drop the habit to sprinkle sys.exit() all over the place. A well-behaved
> > application has one exit point, at the end of the main module.
>
I was u
On Thu, Dec 10, 2015 at 9:20 PM, Peter Otten <__pete...@web.de> wrote:
> Ganesh Pal wrote:
>
> I recommend that you reread the unittest documentation.
>
> setUpClass() should be a class method, and if it succeeds you can release
> the ressources it required in the cor
"one"
def print2():
print "two"
def print3():
print "three"
print_test = [print1(),print2(),print3()] //calling the function
for test in range(len(print_test)):
try:
print_test[test]
except AssertionError as exc:
Regards,
Ganesh
--
https://ma
ter
Sorry if my question sounds dump , I was running pep8 and don't see
its bothered much about it
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
get “Reading GUID from da0xxx: No such file or
directory” error , how to ignore this error and proceed with the above
code
2. Also need to add this check only for mount case i.e mount
/filesystems and not scanner_start
Any recommendations would be appreciated.
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
> (Polite people would *ask* a *question*.)
I am a polite person , sorry if the wording was harsh.
> (“_a non-zero_”, with a space in-between. “anon” can be misunderstood as
an
> abbreviation for “anonymous”.)
It was a typo.
> Most simple solution for this: Do not use a loop. More "complicate
Thanks to Don , Chris and Carl for sharing your view on this topic .
--
https://mail.python.org/mailman/listinfo/python-list
l LOG_DIR
try:
if len(sys.argv) > 1:
LOG_DIR = str(sys.argv[1])
except Exception, e:
print(USAGE)
return errno.EINVAL
functions = [create_logdir,create_dataset,corrupt.prep_cluster]
for func in functions:
try:
func()
Apologies, looks like I did a reply instead of reply-all. So
forwarding this email , please provide guidance on the same
-- Forwarded message --
From: Ganesh Pal
Date: Thu, Jan 7, 2016 at 12:26 PM
Subject: Re: python unit test framework sample code
To: Terry Reedy
> Unless
Totally stuck with this
On Jan 10, 2016 7:11 PM, "Ganesh Pal" wrote:
> Apologies, looks like I did a reply instead of reply-all. So
> forwarding this email , please provide guidance on the same
>
> -- Forwarded message ------
> From: Ganesh Pal
> Date:
gging/__init__.py", line 755, in emit
File "/usr/local/lib/python2.6/logging/__init__.py", line 637, in format
File "/usr/local/lib/python2.6/logging/__init__.py", line 425, in format
File "/usr/local/lib/python2.6/logging/__init__.py", line 295,
I think logging.info(out) works the problem is when I add
logging.info(out,err,ret) ,may be there is a better way to supply this
arguments
On Wed, Feb 17, 2016 at 7:28 PM, Ganesh Pal wrote:
> Hi Team,
>
>
> Iam on python 2.6 and Linux , I had replaced print out, err ret with
>
On Wed, Feb 17, 2016 at 7:32 PM, Chris Angelico wrote:
> The print statement/function happily accepts multiple arguments, and
> will join them according to a set of predefined rules. The logging
> functions don't have those rules, so they take one message and some
> optional parameters. Try this,
e for each tests on the console.
==
ERROR: test_04_inode (__main__.isiCorruptTest)
test04: inode offset, size corruption
--
Traceback (most recent call last):
File "c_t1.py", line 251, in test_04_inode_offset_size_corruption
self.corrupt_baddr['test04']))
KeyError: 'test04'
3. Any other suggestion welcome
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
logging.error(e)
sys.stderr.write("Dataset create failed...Exiting !!!")
sys.exit(EXIT_STATUS_ERROR)
return True
1. Can we have if else with in a try except block
2. How can the above code be improved
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
ed not worry about returning False
functions = [create_logdir, create_dataset]
for func in functions:
try:
func()
except Exception as e:
logging.error(e)
return False
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
On Sun, Feb 21, 2016 at 10:33 PM, Ben Finney wrote:
> You are already supplying a custom message to ‘self.skipTest’::
>
> except Exception as exc:
> logging.error(exc)
> raise unittest.SkipTest("Failure running Integrity Scan ")
>
> So you can change that message by including
l location
7 p = os.popen("%s -t" % sendmail_location, "w")
8 p.write("From: %s\n" % "ganesh@gmail.com")
9 p.write("To: %s\n" % "ganesh@gmail.com")
10 #p.write("To: %s\n" % "umamaheshwa...@g
Thanks it works fine :)
On Fri, Feb 26, 2016 at 5:01 PM, Peter Heitzer
wrote:
> Ganesh Pal wrote:
>>what would be the easiest way to remove the lines in the leading
>>numbers 1.e 1 ,2, 19 from this file using python ?
> import sys,re
> for line in sys.stdin:
>
;,
'machine-4 exited with status 1', 'machine-5 exited with status 1',
'machine-3 exited with status 1']
ERROR:root:list index out of range
3. Any other tips to improve the program
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
changed baddr="" to file ="" in the example program , sorry for the typo
> filename='/tmp2/2.txt'
>
> def check_file():
> """
> Run the command parallel on all the machines , if there is a
> file named /tmp/file2.txt extract file2.txt
>
> """
> global filename
> file = ''
>
>>
> what is run(...)
>
The run (_ is a wrapper it uses suprocess.Popen and returns stdout
,error and extitcod e
> not a good idea to have catchall exception
how to fix this ?
>
>> > return False
>> > if __name__ == '__main__':
>> > main()
>> >
>> --
>>
> copy and paste your tr
: %s\nerr: %s\n" % (ret, out, err)
except Exception as e:
logging.error("Failed to run %s got %s" % (cmd, e))
return False
return True
#script_10.py
Failed to run mount /nfs got ERROR (ret 1):
out:
host-44-3 exited with status 1
err:
hos
ption as e:
logging.error("Failed to run %s got %s" % (cmd, e))
return False
return True
#script_10.py
Failed to run mount /nfs got ERROR (ret 1):
out:
host-44-3 exited with status 1
err:
host-44-3: mount_efs: on /nfs: efs is already mounted
3. my function def has 1000 but Iam using 3600 in the calling fnx etc
, Time out value are overwritten ?
4. Any further improvement particularly on try -except ?
Regards,
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
Iam on python 2.6 , need inputs on the common mistakes in this program
, may be you suggest what need to be improved from
1. usage of try- expect
2. Return of True/ False
3. Other improvement
#!/usr/bin/env python
"""
"""
import os
import shlex
import subprocess
import sys
import time
import lo
On Mon, Feb 29, 2016 at 9:59 PM, Ian Kelly wrote:
> On Mon, Feb 29, 2016 at 8:18 AM, Ganesh Pal wrote:
>> Iam on python 2.6
>> 1. usage of try- expect
>
> try-except in every single function is a code smell. You should only
> be using it where you're actually goin
1 - 100 of 205 matches
Mail list logo