These are chat archives for lamerman/shellpy

2nd
Mar 2016
Nik
@nikudalov
Mar 02 2016 14:52

Hi, @lamerman !

Example of error traceback:

Traceback (most recent call last):
  File "/tmp/shellpy_root/root/cr/scripts/monitor.py", line 272, in <module>
    some_error_line
NameError: name 'some_error_line' is not defined

But, actually, 'some_error_line' is line 262, not 272
Is it possible "compile" to python with same lines numbers as in .spy file?

lamerman
@lamerman
Mar 02 2016 14:54
@nikudalov there is an issue for this, but it's not yet implemented and it is not clear whether it will be possible
Nik
@nikudalov
Mar 02 2016 14:55
Another question:
Is it possible to correct shutdown program with "ctrl+c", for example?
My usual traceback is:
^CTraceback (most recent call last):
  File "/tmp/shellpy_root/root/cr/scripts/monitor.py", line 272, in <module>
Traceback (most recent call last):
  File "/usr/bin/shellpy", line 9, in <module>
    load_entry_point('shellpy==0.4.5', 'console_scripts', 'shellpy')()
  File "/usr/lib/python2.7/site-packages/shellpython/shellpy.py", line 40, in main
    main()
    retcode = subprocess.call(processed_file + ' ' + ' '.join(script_args), shell=True, env=new_env)
  File "/usr/lib64/python2.7/subprocess.py", line 524, in call
  File "/tmp/shellpy_root/root/cr/scripts/monitor.py", line 269, in main
    watchgod()
  File "/tmp/shellpy_root/root/cr/scripts/monitor.py", line 232, in watchgod
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib64/python2.7/subprocess.py", line 1376, in wait
    sleep(30)
KeyboardInterrupt
    pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
  File "/usr/lib64/python2.7/subprocess.py", line 478, in _eintr_retry_call
    return func(*args)
KeyboardInterrupt
lamerman
@lamerman
Mar 02 2016 14:56
How do you want it to look? :)
Strange smiles here )
Nik
@nikudalov
Mar 02 2016 14:57
iphone style )
lamerman
@lamerman
Mar 02 2016 14:57
Yes possibly )
@nikudalov the issue number is #2 for errors
But as I said now it's not so clear how to make it
Nik
@nikudalov
Mar 02 2016 14:59
something like correct shutdown.
I just execute sleep 10 command and interrupt it
Oh, I see it now (#2)
lamerman
@lamerman
Mar 02 2016 15:01
Could you please paste the part of shellpy code where you interrupt it?
As I understand it's monitor.py:272
Ah no 232
Nik
@nikudalov
Mar 02 2016 15:04
while True:
    some_code_1()
    `sleep 30
    some_code_2()
Something like this.
lamerman
@lamerman
Mar 02 2016 15:05
As I understand you want to remove from the stack trace everything that is above monitor.py
Main of shell py and subprocess
Is it correct?
Nik
@nikudalov
Mar 02 2016 15:06
Yes, because in general there is no errors )
lamerman
@lamerman
Mar 02 2016 15:07
Ok I think it is possible and reasonable, we could create an issue
Either you or me a bit later
Or it could be a part of task 2, just comment could be added there
Nik
@nikudalov
Mar 02 2016 15:08
But in any break you will get stack trace (not like bash-script style:)
Looks like separate issue
lamerman
@lamerman
Mar 02 2016 15:08
Yes
@nikudalov, btw as I understand you use shellpy. Could you share your thoughts? Is there something missing that definitely should be added? How does it work in general?
Nik
@nikudalov
Mar 02 2016 15:14
Yep, I already wrote 262 lines of shellpy code )
Let me think about it and I'll write you a little bit later my opinion
lamerman
@lamerman
Mar 02 2016 15:14
ok, thank you