{"action":"created","issue":{"url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/1270","labels_url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/1270/labels{/name}","comments_url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/1270/comments","events_url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/1270/events","html_url":"https://github.com/pyinstaller/pyinstaller/issues/1270","id":76544389,"number":1270,"title":"Under Python3, pyi-archive_viewer cannot process the 'o' command","user":{"login":"tallforasmurf","id":1137018,"avatar_url":"https://avatars.githubusercontent.com/u/1137018?v=3","gravatar_id":"","url":"https://api.github.com/users/tallforasmurf","html_url":"https://github.com/tallforasmurf","followers_url":"https://api.github.com/users/tallforasmurf/followers","following_url":"https://api.github.com/users/tallforasmurf/following{/other_user}","gists_url":"https://api.github.com/users/tallforasmurf/gists{/gist_id}","starred_url":"https://api.github.com/users/tallforasmurf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tallforasmurf/subscriptions","organizations_url":"https://api.github.com/users/tallforasmurf/orgs","repos_url":"https://api.github.com/users/tallforasmurf/repos","events_url":"https://api.github.com/users/tallforasmurf/events{/privacy}","received_events_url":"https://api.github.com/users/tallforasmurf/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-15T01:06:06Z","updated_at":"2015-05-15T17:12:30Z","closed_at":"2015-05-15T17:12:30Z","body":"When pyi-archive_viewer is applied to a .pyz archive, for example `pyi-archive_viewer build\\MYAPP\\out00-PYZ.pyz` it operates correctly displaying all elements. Also when applied to a frozen executable, it correctly shows the top level of contents, for example:\r\n\r\n    > pyi-archive_viewer dist\\PPQT2\\PPQT2.exe\r\n     pos, length, uncompressed, iscompressed, type, name\r\n    [(0, 2054114, 2054114, 0, b'z', b'out00-PYZ.pyz'),\r\n     (2054114, 258, 329, 1, b'm', b'struct'),\r\n     (2054372, 1160, 2009, 1, b'm', b'pyi_os_path'),\r\n     (2055532, 4674, 10342, 1, b'm', b'pyi_archive'),\r\n     (2060206, 4618, 12461, 1, b'm', b'pyi_importers'),\r\n     (2064824, 2005, 4781, 1, b's', b'_pyi_bootstrap'),\r\n     (2066829, 706, 1422, 1, b's', b'pyi_rth_qt5plugins'),\r\n     (2067535, 969, 2248, 1, b's', b'pyi_rth_qt5'),\r\n     (2068504, 4557, 14607, 1, b's', b'pyi_carchive'),\r\n     (2073061, 1018, 1947, 1, b's', b'PPQT2')]\r\n\r\nhowever it cannot recognize any name given to the Open command,\r\n\r\n    ? o out00-PYZ.pyz\r\n    out00-PYZ.pyz not found\r\n\r\nThe reason is that (as you can see in the display!) the names in the CTOC structure are BYTES types. The command string returned to the input() function is a STRING, and `str('out00-PYZ.pyz') != bytes('out00-PYZ.pyz')`.\r\n\r\nIt is not clear to me where this should be fixed. A quick & dirty fix would be to modify the pyi_carchive.CTOC.find() method to force the name argument to bytes. Or would it be better to modify the add() method to decode its \"nm\" argument to string? (This might have side-effects?)\r\n"},"comment":{"url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/comments/102460874","html_url":"https://github.com/pyinstaller/pyinstaller/issues/1270#issuecomment-102460874","issue_url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/1270","id":102460874,"user":{"login":"htgoebel","id":784161,"avatar_url":"https://avatars.githubusercontent.com/u/784161?v=3","gravatar_id":"","url":"https://api.github.com/users/htgoebel","html_url":"https://github.com/htgoebel","followers_url":"https://api.github.com/users/htgoebel/followers","following_url":"https://api.github.com/users/htgoebel/following{/other_user}","gists_url":"https://api.github.com/users/htgoebel/gists{/gist_id}","starred_url":"https://api.github.com/users/htgoebel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htgoebel/subscriptions","organizations_url":"https://api.github.com/users/htgoebel/orgs","repos_url":"https://api.github.com/users/htgoebel/repos","events_url":"https://api.github.com/users/htgoebel/events{/privacy}","received_events_url":"https://api.github.com/users/htgoebel/received_events","type":"User","site_admin":false},"created_at":"2015-05-15T17:12:30Z","updated_at":"2015-05-15T17:12:30Z","body":"I stepped over this, too, but forgot about it. You need to \r\n1. *encode* the *names* when writing the archive and\r\n2. *decode* only the names when reading."}}