traceback formating ??

21 views
Skip to first unread message

quetzal

unread,
Apr 13, 2017, 2:29:24 AM4/13/17
to karrigell
hello...all

an old and little and regular problematic problem of just nothing but ennoying... ;o)

the format of the traceback... just unreadeable... 

is there a "smart" little solution to get this "traceback" and rebuilt its format "on the fly" ?? 

thanks a lot, if somebody still here... (have a nice day too)

axl rose

unread,
Apr 13, 2017, 4:17:13 AM4/13/17
to karr...@googlegroups.com
Hello, I advice you to use flask, django, twisted, if you really need to build a website in python, karrigel it is not alive

--
You received this message because you are subscribed to the Google Groups "karrigell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to karrigell+unsubscribe@googlegroups.com.
To post to this group, send email to karr...@googlegroups.com.
Visit this group at https://groups.google.com/group/karrigell.
For more options, visit https://groups.google.com/d/optout.

quetzal

unread,
Apr 13, 2017, 6:02:29 AM4/13/17
to karrigell
here the form of the traceback... of my karrigell4.3.10

and my problem...

Traceback (most recent call last): File "C:\Python34\lib\site-packages\Karrigell\Karrigell.py", line 181, in handle_data self.run(func) File "C:\Python34\lib\site-packages\Karrigell\Karrigell.py", line 353, in run result = self.namespace[func](**self.body) # string or bytes File "D:\AAA\gazzler\gazzler.py", line 200, in websource sdb.save(data,"gazzler/source/%s.html"%search) File "C:\Python34\lib\Qmod\sdb.py", line 103, in save out.write(items) File "C:\Python34\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u2032' in position 0: character maps to

quetzal

unread,
Apr 13, 2017, 6:05:49 AM4/13/17
to karrigell
hm, why do think i've choice karrigell then ? may be not followed by its owner...
but still the shortest way to output something.. and they're no contest about it...

axl rose

unread,
Apr 13, 2017, 11:02:25 AM4/13/17
to karr...@googlegroups.com
the problem is, karrigell support only python2 and you are using python34

On Thu, Apr 13, 2017 at 1:05 PM, quetzal <quetz...@numericable.fr> wrote:
hm, why do think i've choice karrigell then ? may be not followed by its owner...
but still the shortest way to output something.. and they're no contest about it...

Nicolas Pinault

unread,
Apr 13, 2017, 3:31:30 PM4/13/17
to karr...@googlegroups.com

Le 13/04/2017 à 17:02, axl rose a écrit :
the problem is, karrigell support only python2 and you are using python34
There is a Karrigell version for Python3 here https://github.com/PierreQuentel/Karrigell (version 4.3.10).
To unsubscribe from this group and stop receiving emails from it, send an email to karrigell+...@googlegroups.com.

Nicolas Pinault

unread,
Apr 13, 2017, 3:37:28 PM4/13/17
to karr...@googlegroups.com
Except the missing line returns, this is a standard Python trace back.
One can read that there is a character encoding error at line 200 in
file D:\AAA\gazzler\gazzler.py
I guess there is a "special" character like é, è, à or something else
and you have forgotten to declare an encoding at the beginning of the file.

Bonne soirée,
Nicolas

quetzal

unread,
Apr 14, 2017, 1:38:56 AM4/14/17
to karrigell
hi, nico... thank for your answer...

the adress just target a folder on D:/AAA/(it permit to have this file ever on top in a windows explorer) where i've put all my web.page and other web.app driven Karrigell... 
i've created a py.file to launch a karrigell server on 8000 or 8080 any other... a shortcut of it in speed lauching.. 

it seems not to be the adress the problem of the traceback ? no far-foreign carracter into... only the missing "line return" as you seen, which drive's me out... 

Nicolas Pinault

unread,
Apr 15, 2017, 4:18:50 AM4/15/17
to karr...@googlegroups.com
Can you send me a zip of your project to let me analyse it ?
--
You received this message because you are subscribed to the Google Groups "karrigell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to karrigell+...@googlegroups.com.

Nicolas Pinault

unread,
Apr 15, 2017, 4:53:19 AM4/15/17
to karr...@googlegroups.com
Hi,

Looking at it a little bit closer :

Reformat the traceback first to better understand it :

Traceback (most recent call last):
File "C:\Python34\lib\site-packages\Karrigell\Karrigell.py", line 181, in handle_data self.run(func)
File "C:\Python34\lib\site-packages\Karrigell\Karrigell.py", line 353, in run result = self.namespace[func](**self.body) # string or bytes
File "D:\AAA\gazzler\gazzler.py", line 200, in websource sdb.save(data,"gazzler/source/%s.html"%search)
File "C:\Python34\lib\Qmod\sdb.py", line 103, in save out.write(items)
File "C:\Python34\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u2032' in position 0: character maps to

What I understand here is that in file gazzler.py, line 200, the function sdb.save() is called. This call generates an UnicodeEncodeError exception.
This means that one of the parameters passed to sdb.save() can't be encoded to cp1252 format. Either parameter "data" or "search"  is problematic.

Bonne journée,
Nicolas


Le 14/04/2017 à 07:38, quetzal a écrit :
--
You received this message because you are subscribed to the Google Groups "karrigell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to karrigell+...@googlegroups.com.

quetzal

unread,
Apr 15, 2017, 5:46:10 PM4/15/17
to karrigell
in fact, this lack of formating is only present after an ajax callback... if the error happened directly when the page is loaded by the karrigell server, no problem..

but if after clic=> javascript => ajax(prototype) => server => page.py = [ERROR] => the return

ajax function type #
[javascript]
function fen2(aa,bb){ new Ajax.Updater( 'A31', '../catcher.py/ressource', { method: 'get', parameters:{adr:bb} }); xxxx(aa); }
[/javascript]

the DIV 'A31' is the "id-return" of the function calls in /gazler.py/ressource" with { adr:bb } as parameter

i used this way so oftenly that i thought it was directly a Karrigell problem... but it's really spécific looking to it closely...

an idea ?

it's prototype1.7.2js (i do not use jQuery)

quetzal

unread,
Apr 26, 2017, 5:30:09 PM4/26/17
to karrigell
finnaly, i've found it... some ajax calls (all??) are sendback as successfull when they bringback from the server python an error... then it write the traceback it is send, without any "<br>" in its formating, only somes ("/n")... and then the traceback do appears as if was not having its usual formating...

exemple with prototypes1.7.2: a simple button call by ajax to karrigell-python(solution)

javascript:
function testjx(){ new Ajax.Updater('result','../pythonfile.py/bao',
{ method:'get',
parameters: {aa:"hello"},
onComplete:function(trace){ rep=(trace.responseText); newtrace(rep); }, }); }

function newtrace(aaa){ if (aaa.indexOf("Traceback (most recent call last)") != -1){
var x1 = aaa.split("\n");
var x2 = aaa.split("\n");
var x21 = x2.reverse()[1];
var last = x2.length-2;
var neo = ("<br><b>"+ x21 +"</b>")
x1.splice(last,1,neo);};
$('result').innerHTML= x1.join("<br>");
$('result').style.color='black';
$('result').style.fontSize=20; }

$('result') le nom de la fenêtre de retour et de position du <button>

html-karrigell-python:

def bao(aa):
bb = aa + ", then you're fine now ?"
return bb
def blah():
cc = BUTTON("clic here", onclick="testjx();",
style="float:left; width:100px; height:30px;")
return cc

si dès fois, M.Quentel passe par là et à une meilleure idée, faire en sorte que le traceback puisse-être considéré comme un échec ou autres...

Nicolas Pinault

unread,
Apr 30, 2017, 12:58:24 PM4/30/17
to karr...@googlegroups.com
Il faudrait créer une issue ici :
https://github.com/PierreQuentel/Karrigell/issues

>

Pierre Quentel

unread,
Apr 30, 2017, 3:19:30 PM4/30/17
to karrigell
Bonjour,

Je ne maintiens plus Karrigell depuis des années. C'est le destin des projets Open Source : dans le monde surchargé des frameworks web, Karrigell n'a pas trouvé sa place, et je me consacre presque exclusivement à Brython, qui lui a réussi à faire son trou dans un autre domaine (Python dans le navigateur).

Le projet est sur Github donc n'importe qui peut forker et l'améliorer.

Bonne chance !
Pierre

quetzal

unread,
May 1, 2017, 5:39:18 AM5/1/17
to karrigell
j'ai bien vu que Karrigell n'était plus maintenu.
quant à brython, j'y ait fait un tour il y a un an, mais je n'avais pas le niveau pour y comprendre grand chose... débutant en javascript et HTML...
Karrigell est au moins bien pour cela, le premier pas... (donc essentiel)

j'ai été re-faire un tour vers Brython, tout y est (aujourd'hui) bien plus clair... je suppose qu'il est possible de remplacer mes pages javascript par des pages Brython avec en serveur de fond karrigell (j'espère)

autres chose, pypy a prévue un dévelopement en python3.5 uniquement... mais, karrigell s'arrête à 3.4... une update pourrait-elle envisagée... ou bien, ce projet est définitivement mort...

je dis cela, car l'option, reprendre derrière vous la maintenance ou le développement de karrigel est juste encore vraiment hors de mes compétences... j'y suis allé voir, pour voir... mais si j'arrive a comprendre deux ou trois trucs, l'essentiel de cette manière de coder m'est encore bien étrangère...

merci encore toutefois pour ce framework...

Helmut Jarausch

unread,
May 1, 2017, 6:36:52 AM5/1/17
to karr...@googlegroups.com, quetzal
I am sorry I don't speak French.
I've just tested that Karrigell runs just fine under Python-3.6.1 (and
therefore under Python-3.5.x)
Even if development has stalled one can still use Karrigell (and it is
not too hard to under the Python source)

Helmut

Nicolas Pinault

unread,
May 2, 2017, 3:25:20 PM5/2/17
to karr...@googlegroups.com
Le 01/05/2017 à 11:39, quetzal a écrit :
> j'ai bien vu que Karrigell n'était plus maintenu.
> quant à brython, j'y ait fait un tour il y a un an, mais je n'avais pas le niveau pour y comprendre grand chose... débutant en javascript et HTML...
> Karrigell est au moins bien pour cela, le premier pas... (donc essentiel)
>
> j'ai été re-faire un tour vers Brython, tout y est (aujourd'hui) bien plus clair... je suppose qu'il est possible de remplacer mes pages javascript par des pages Brython avec en serveur de fond karrigell (j'espère)
Malheureusement, ce n'est pas possible par défaut.
Avec Brython, le serveur WEB doit envoyer le contenu des fichiers Python
au navigateur comme de "vulgaires" fichiers texte.
Karrigell, lui, exécute les fichiers Python demandés par le navigateur
et renvoie le "résultat" de cette exécution au navigateur.
Les deux fonctionnements sont donc totalement incompatibles.
Mais rien n'est perdu. Il est possible de :
1- créer un workaround qui permet aux 2 mondes de cohabiter sans changer
Karrigell. Mais c'est moche et pas efficace.
2- modifier Karrigell.
Perso, j'ai utilisé l'option 1 dans un projet.
Je pense que l'option 2 est meilleure. Mais pour ça, il faut modifier le
code de Karrigell. Et ça fait quelques années que je n'ai plus mis le
nez dedans. Alors, il me faudrait une bonne raison pour m'y replonger ;)

>
> autres chose, pypy a prévue un dévelopement en python3.5 uniquement... mais, karrigell s'arrête à 3.4... une update pourrait-elle envisagée... ou bien, ce projet est définitivement mort...
Karrigell est compatible Python3. Sauf erreur de ma part, il n'y a
aucune spécificité dans le code qui l’empêcherait de tourner avec les
autres versions de Python.
>
> je dis cela, car l'option, reprendre derrière vous la maintenance ou le développement de karrigel est juste encore vraiment hors de mes compétences... j'y suis allé voir, pour voir... mais si j'arrive a comprendre deux ou trois trucs, l'essentiel de cette manière de coder m'est encore bien étrangère...
>
> merci encore toutefois pour ce framework...
Rien n'est perdu :)
Reply all
Reply to author
Forward
0 new messages