Issue104

Title Re-executing itself causes SyntaxError with compiled binaries (help wanted)
Priority bug Status done-cbb
Superseder Nosy List kayhayen, rmurri
Assigned To kayhayen Keywords help_wanted

Created on 2013-08-19.12:29:17 by rmurri, last changed by kayhayen.

Messages
msg447 (view) Author: kayhayen Date: 2013-09-30.13:45:19
I really wish in some way, Nuitka could be patching up the standard library 
functions that are typically used for this, to detect this case, and handle it 
by executing the binary directly.

Puting this to done, could be better, for that reason. Also added help wanted 
tag, as this is something that could easily be contributed by others.
msg420 (view) Author: kayhayen Date: 2013-08-20.06:08:39
Hello,

can it be that "mgn.exe" somehow re-executes itself, along the lines of "python 
...". Because the error absolutely looks as if you did "python mgn.exe", 
otherwise, Nuitka should already give you the error for main module, or a 
warning it's going to happen for imported modules. You would definitely not get 
"mgn.exe" as a filename normally.
msg418 (view) Author: rmurri Date: 2013-08-19.12:29:17
Hello,

I am trying Nuitka on the FatGHoL code (http://fatghol.googlecode.com)
but it gives me this error:


    > ./mgn.exe -v homology 0,4
      File "./mgn.exe", line 1
    SyntaxError: Non-ASCII character '\x84' in file ./mgn.exe on line 2, but no
encoding declared; see http://www.python.org/peps/pep-0263.html for details

However:

1) There's no non-ASCII character in my sources:

    (kayhayen-Nuitka-6fcd0fa)> cat ../find_nonascii_chars.py
    #! /usr/bin/env python

    import sys

    for filename in sys.argv[1:]:
        fd = open(filename)
        for lineno, line in enumerate(fd):
            for pos, ch in enumerate(line):
                if ord(ch) > 127:
                    print ("%s:%d: non-ASCII character '%s' at column %d"
                           % (filename, lineno, ch, pos))
    (kayhayen-Nuitka-6fcd0fa)> ../find_nonascii_chars.py *.py | wc -l
    0

2) All the source files are declared as UTF-8 anyway:

    $ fgrep -A1 'env python' *.py
    aggregate.py:#! /usr/bin/env python
    aggregate.py-# -*- coding: utf-8 -*-
    --
    cache.py:#! /usr/bin/env python
    cache.py-# -*- coding: utf-8 -*-
    --
    combinatorics.py:#! /usr/bin/env python
    combinatorics.py-# -*- coding: utf-8 -*-
    --
    const.py:#! /usr/bin/env python
    const.py-# -*- coding: utf-8 -*-
    --
    cyclicseq.py:#! /usr/bin/env python
    cyclicseq.py-# -*- coding: utf-8 -*-
    --
    graph_homology.py:#! /usr/bin/env python
    graph_homology.py-# -*- coding: utf-8 -*-
    --
    homology.py:#! /usr/bin/env python
    homology.py-# -*- coding: utf-8 -*-
    --
    iterators.py:#! /usr/bin/env python
    iterators.py-# -*- coding: utf-8 -*-
    --
    loadsave.py:#! /usr/bin/env python
    loadsave.py-# -*- coding: utf-8 -*-
    --
    mgn.py:#! /usr/bin/env python
    mgn.py-# -*- coding: utf-8 -*-
    --
    N.py:#! /usr/bin/env python
    N.py-# -*- coding: utf-8 -*-
    --
    output.py:#! /usr/bin/env python
    output.py-# -*- coding: utf-8 -*-
    --
    rg.py:#! /usr/bin/env python
    rg.py-# -*- coding: utf-8 -*-
    --
    runtime.py:#! /usr/bin/env python
    runtime.py-# -*- coding: utf-8 -*-
    --
    timing.py:#! /usr/bin/env python
    timing.py-# -*- coding: utf-8 -*-
    --
    utils.py:#! /usr/bin/env python
    utils.py-# -*- coding: utf-8 -*-
    --
    valences.py:#! /usr/bin/env python
    valences.py-# -*- coding: utf-8 -*-

How can I go on debugging this issue?
History
Date User Action Args
2013-09-30 13:45:19kayhayensetstatus: chatting -> done-cbb
messages: + msg447
keyword: + help_wanted
title: Erroneous non-ASCII character error? -> Re-executing itself causes SyntaxError with compiled binaries (help wanted)
2013-08-20 06:08:39kayhayensetstatus: unread -> chatting
assignedto: kayhayen
messages: + msg420
nosy: + kayhayen
2013-08-19 12:29:17rmurricreate