Josu: Su pregunta no es realmente una cuestión pywin32. "Subprocess" es parte de la biblioteca estándar de Python, y las preguntas se deben enviar a esa lista. Véase: http://mail.python.org/mailman/listinfo/python-list. ( Your question is not really a pywin32 question. Subprocess is part of the Python standard library, and questions should be sent to that list.) -- Vernon Cole
On Fri, Jan 23, 2009 at 2:36 AM, Josu Rodriguez <jrvi...@gmail.com> wrote: > Hola a todos, > > Tengo problemas para ejecutar comandos en el sistema, con caracteres > unicode. > > el problema es a la hora de ejecutar un, por ejemplo : 'dir c:\ñ\' > > He intentado de varias formas y todas con caracteres unicode me devuelven > error. > La función que ejecuto es la siguiente: > > command='explorer c:\\ñ\\' > command1=u'explorer c:\\ñ\\' > command2=unicode('explorer c:\\ñ\\','cp850') > command3=command2.encode('utf-8') > command5='explorer c:\new\' > command6=u'explorer c:\new\' > command7=u'explorer c:\\new\\' > command8=u'explorer c:\\new\\' > > > import sys > import subprocess > sp=subprocess > > subprocess.Popen(command, stdout=sp.PIPE, stderr=sp.STDOUT) #Lanza > explorer pero no en la ruta adecuada. > > subprocess.Popen(command1, stdout=sp.PIPE, stderr=sp.STDOUT) > #UnicodeEncodeError: 'ascii' codec ... > > subprocess.Popen(command2, stdout=sp.PIPE, stderr=sp.STDOUT) > #UnicodeEncodeError: 'ascii' codec ... > > subprocess.Popen(command2, stdout=sp.PIPE, stderr=sp.STDOUT) #Lanza > explorer pero no en la ruta adecuada, diferente a la primera. > > subprocess.Popen(command5, stdout=sp.PIPE, stderr=sp.STDOUT) #[Error > 123] > > subprocess.Popen(command6, stdout=sp.PIPE, stderr=sp.STDOUT) #[Error > 123] > > subprocess.Popen(command7, stdout=sp.PIPE, stderr=sp.STDOUT) #OK pero no > es unicode > subprocess.Popen(command8, stdout=sp.PIPE, stderr=sp.STDOUT) #OK pero no > es unicode > > ¿Alguien sabe como se resuelve este problemita? > > > Muchas gracias > > > _______________________________________________ > python-win32 mailing list > python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > > _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32