Title Portable mode import json not working
Priority bug Status resolved
Superseder Nosy List benoit, kayhayen
Assigned To kayhayen Keywords standalone

Created on 2013-12-06.03:17:20 by benoit, last changed by kayhayen.

msg536 (view) Author: kayhayen Date: 2013-12-08.12:26:07
Released as hotfix
msg535 (view) Author: kayhayen Date: 2013-12-06.19:29:50
There is a fix and test case in factory.

It's not structural, i.e. one cannot like how this is not complete. I must say 
that I am still thinking how to properly address this.

Having the ability to bytecode include whole packages would be nice. And surely, 
as a user interface, the ability to add imports could also help.

The json example also should work now.
msg534 (view) Author: kayhayen Date: 2013-12-06.07:51:52
This is the minimal producer already:


The issue is that the encodings package is only frozen for as much as it is used 
for stdio/stdout, but "hex" seems to be implemented as an encoding too.

Thanks for the report, going to improve this. Not sure how.

Looks as if one must include the "encodings" package completely, or at least 
some encodings in any case.
msg533 (view) Author: benoit Date: 2013-12-06.03:17:20
I am trying to create a portable binary of something really simple

Here is my file
import json

b = json.dumps(['a','b','c'])

f = open('test.json', 'wb')

g = open('test.json', 'rb')
st =
res = json.loads(st)

print res

nuitka works fine and i can run ./json_test.exe without any issue
test.json is created and the output is [u'a', u'b', u'c']

nuitka --portable is working but when I launch ./json_test.exe in the json_test.dist folder here is the traceback

Traceback (most recent call last):
  File "", line 1, in <module>
  File "/usr/lib/python2.7/json/", line 108, in json
    from .decoder import JSONDecoder
  File "/usr/lib/python2.7/json/", line 24, in decoder
    NaN, PosInf, NegInf = _floatconstants()
  File "/usr/lib/python2.7/json/", line 18, in _floatconstants
    _BYTES = '7FF80000000000007FF0000000000000'.decode('hex')
LookupError: unknown encoding: hex

I am running on Mint LMDE 
uname -a : 3.10-2-amd64 #1 SMP Debian 3.10.5-1 (2013-08-07) x86_64 GNU/Linux
python --version: Python 2.7.5+
gcc --version: gcc (Debian 4.7.3-4) 4.7.3
pip freeze: Nuitka==
Date User Action Args
2013-12-08 12:26:07kayhayensetstatus: testing -> resolved
messages: + msg536
2013-12-06 19:29:50kayhayensetstatus: in-progress -> testing
messages: + msg535
2013-12-06 07:51:52kayhayensetstatus: unread -> in-progress
assignedto: kayhayen
messages: + msg534
keyword: + standalone
nosy: + kayhayen
2013-12-06 03:17:20benoitcreate