Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #103593 > unrolled thread
| Started by | Ganesh Pal <ganesh1pal@gmail.com> |
|---|---|
| First post | 2016-02-27 22:31 +0530 |
| Last post | 2016-02-27 22:31 +0530 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: list index out of range Error , need to fix it or ignore it Ganesh Pal <ganesh1pal@gmail.com> - 2016-02-27 22:31 +0530
| From | Ganesh Pal <ganesh1pal@gmail.com> |
|---|---|
| Date | 2016-02-27 22:31 +0530 |
| Subject | Re: list index out of range Error , need to fix it or ignore it |
| Message-ID | <mailman.182.1456592525.20994.python-list@python.org> |
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 = ''
> cmd = ("run_al_paral 'ls -al %s'" % (filename))
> print(cmd)
> stdout, stderr, exitcode = run(cmd)
> print(stdout)
> lines = stdout.strip().split('\n')
> print(lines)
> for line in lines:
> if 'exited' in lines:
> continue
>
> file = lines[0].split()[9][6:]
> break
> print file
> return file
>
> def main():
> functions = [check_file]
> for func in functions:
> try:
> func()
> except Exception as e:
> return False
> if __name__ == '__main__':
> main()
>
Back to top | Article view | comp.lang.python
csiph-web