Python error.

Iniciado por Assed [In]Seguridad Informática, Marzo 11, 2016, 01:45:42 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Marzo 11, 2016, 01:45:42 PM Ultima modificación: Marzo 12, 2016, 04:04:51 PM por rollth
Buenas gente que tal aquí tengo un problema con python,lo cuál me genera un error al abrir un script desde la shell de windows.Pero desde la shell de python cuando lo ejecuto el script va 10 puntos!.

Bueno el problema es cuando escribo tan solo cualquier linea de codigo que sea sobre el lenguaje python me toma el siguiente error.


C:\Users\Alguien\Desktop>python
  File "C:\Users\Alguien\Desktop\python.py", line 1
SyntaxError: Non-ASCII character '\xc2' in file C:\Users\Alguien\Desktop\pytho
n.py on line 1, but no encoding declared; see You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
3/ for details

bueno eso es cuando lo quiero ejecutar desde la shell de windows 8.1.CMD.Cuando lo ejecuto desde la shell python,va sin problemas.


(Cuando lo ejecuto con el IDLE Python.... sin problemas...)

pero cuando lo ejecuto desde la shell de windows pasa ese error.Y cabe destacar que me instale el PentestBox,capaz muchos lo conoscan es un proyecto orientado al pentesting con windows y bueno en la shell del pentesbox cuando quiero ejecutar el python pasa exactamente lo mismo que comente arriba,es decir,esto:

C:\Users\Alguien\Desktop>python
  File "C:\Users\Alguien\Desktop\python.py", line 1
SyntaxError: Non-ASCII character '\xc2' in file C:\Users\Alguien\Desktop\pytho
n.py on line 1, but no encoding declared; see You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
3/ for details

;D,Espero que me puedan dar una manito con este problema.Saludos Foro!
Passion informatic.

Pon esto hasta arriba del codigo

Citar# -*- coding: utf-8 -*-

CitarTo fix this, just put the line
# coding=utf-8
at the very top of the code file.
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login


Tambien puedes cambiar el encoding de la shell de windows, tipea:

Código: text
chcp 65001


y prueba ejecutarlo denuevo.

You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
Pon esto hasta arriba del codigo

Citar# -*- coding: utf-8 -*-

CitarTo fix this, just put the line
# coding=utf-8
at the very top of the code file.
Hola!!,las 2 cosas? dices? o solo la primera línea que me ha indicado?
Passion informatic.

Pon:
Citar# coding=utf-8

ó si no funciona

Citar# -*- coding: utf-8 -*-
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login


Marzo 11, 2016, 09:30:18 PM #5 Ultima modificación: Marzo 12, 2016, 04:10:01 PM por rollth
    You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
    Pon:
    Citar# coding=utf-8

    ó si no funciona

    Citar# -*- coding: utf-8 -*-

    que tal amigo, pongo esto     # -*- coding: utf-8 -*- y no me funciono y pongo el otro y You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login decir ahora me lo ejecuta pero al seguir con el script no muestra más cosas que tiene.
    Ejemplo:
    Al poner cuando me pide la URL la pongo pero tira un error que no alcanzo a ver y se cierra..

    [/list]
    Passion informatic.

    You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
      You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
      Pon:
      Citar# coding=utf-8

      ó si no funciona

      Citar# -*- coding: utf-8 -*-

      que tal amigo, pongo esto     # -*- coding: utf-8 -*- y no me funciono y pongo el otro y You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login decir ahora me lo ejecuta pero al seguir con el script no muestra más cosas que tiene.
      Ejemplo:
      Al poner cuando me pide la URL la pongo pero tira un error que no alcanzo a ver y se cierra..


      [/list]

      Prueba a poner lo siguiente en la consola y nos pasas el error.

      python You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login > archivo.txt

      Se creara un archivo.txt donde pondrá el error, de ahi nos puedes decir que te sale.
      RollthBuen hacker mejor You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login/You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

      Buenas.

      Lo mejor es que compartas tanto el código como el error. Para ver el error, abrí el cmd, movete hasta el directorio donde se encuentra el script (aparentemente el escritorio) y ejecutalo. No tendría porqué cerrarse la consola.

      Más allá de este error en particular, es muy importante ver el código ya que inspeccionándolo, rápidamente podemos ver qué otros errores pueden llegar a existir.

      Saludos!