You could read your stdin input into a list first, then reset stdin:
stdin_list = list(sys.stdin)
sys.stdin = open('/dev/tty')
for filepath in stdin_list:
dir = os.path.basename(filepath)
...
IPython.embed()
Use --verbosity, where it is supported, to specify the amount of notification and debug information that django-admin prints to the console.,Specifies the amount of notification and debug information that a command should print to the console.,When reading from stdin, the --format option is required to specify the serialization format of the input (e.g., json or xml).,Run django-admin help to display usage information and a list of the commands provided by each application.
$ django-admin <command> [options]
$ manage.py <command> [options]
$ python -m django <command> [options]
...\> django-admin <command> [options]
...\> manage.py <command> [options]
...\> py -m django <command> [options]
1.4.dev17026 1.4 a1 1.4
django - admin check auth admin myapp
django - admin check--tag models--tag compatibility
django - admin check--database
default --database other
New in version 3.7: pdb.py now accepts a -m option that execute modules similar to the way python3 -m does. As with a script, the debugger will pause execution just before the first line of the module.,New in version 3.2: pdb.py now accepts a -c option that executes commands as if given in a .pdbrc file, see Debugger Commands.,The debugger supports aliases. Aliases can have parameters which allows one a certain level of adaptability to the context under examination.,The debugger is extensible – it is actually defined as the class Pdb. This is currently undocumented but easily understood by reading the source. The extension interface uses the modules bdb and cmd.
>>> import pdb
>>> import mymodule
>>> pdb.run('mymodule.test()')
> <string>(0)?()
(Pdb) continue
> <string>(1)?()
(Pdb) continue
NameError: 'spam'
> <string>(1)?()
(Pdb)
python3 - m pdb myscript.py
import pdb;
pdb.set_trace()
>>> import pdb
>>> import mymodule
>>> mymodule.test()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "./mymodule.py", line 4, in test
test2()
File "./mymodule.py", line 3, in test2
print(spam)
NameError: spam
>>> pdb.pm()
> ./mymodule.py(3)test2()
-> print(spam)
(Pdb)
import pdb;
pdb.Pdb(skip = ['django.*']).set_trace()
(Pdb) commands 1
(com) p some_variable(com) end(Pdb)
Exceptions are raised by errors in Python:,Debugging after an exception occurs,Catching exceptions try/except try/finally Raising exceptions ,TypeError: unsupported operation
>> 1/0
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ZeroDivisionError: division by zero
>>> 1+'apple'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'str'
>>> eng2kor = {'three': 'set', 'two': 'dool', 'one': 'haha'}
eng2kor[0]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: 0
>>> a = [1, 2, 3]
>>> a[4]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: list index out of range
>>> eng2kor.append('foo')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'dict' object has no attribute 'append'
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15