IndexError when calling transcrypt from a shell script
Output when attempting to execute from a shell script: I may be missing something obvious here.
Transcrypt (TM) Python to JavaScript Small Sane Subset Transpiler Version 3.6.101
Copyright (C) Geatec Engineering. License: Apache 2.0
Performing static type validation on application: /home/user/Documents/example/src/index.py
Problems encountered during static type check
mypy: can't read file '/home/user/Documents/example/src/i': No such file or directory
list index out of rangeTraceback (most recent call last):
File "/home/user/.virtualenvs/transcrypt-test/lib/python3.6/site-packages/transcrypt/modules/org/transcrypt/compiler.py", line 167, in __init__
moduleMetadata = ModuleMetadata (self, self.mainModuleName)
File "/home/user/.virtualenvs/transcrypt-test/lib/python3.6/site-packages/transcrypt/modules/org/transcrypt/compiler.py", line 68, in __init__
'\n\tCan\'t find any of:\n\t\t{}\n'.format ('\n\t\t'. join (searchedModulePaths))
org.transcrypt.utils.Error: <unprintable Error object>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/.virtualenvs/transcrypt-test/lib/python3.6/site-packages/transcrypt/__main__.py", line 159, in main
compiler.Program (transpilationDirs, modulesDir, __symbols__)
File "/home/user/.virtualenvs/transcrypt-test/lib/python3.6/site-packages/transcrypt/modules/org/transcrypt/compiler.py", line 172, in __init__
message = '\n\t{}'.format (str (exception))
File "/home/user/.virtualenvs/transcrypt-test/lib/python3.6/site-packages/transcrypt/modules/org/transcrypt/utils.py", line 150, in __str__
result += '\n\tFile \'{}\', line {}, namely:'.format (program.importStack [-1][0] .sourcePath, self.lineNr)
IndexError: list index out of range
Aborted
What were the exact contents of the shell script, especially the command that started Transcrypt?
I tested it with a shell script that contained simply: transcrypt test.py and experienced the same error.
Quite a lot has been changed in how Transcrypt handles paths, files, build versus make etc. Does this problem still exist with TS >= 3.7.6?
Hi. I was following the documentation. Went to the console and typed transcrypt hello. I am getting the same error.
Quite a lot has been changed in how Transcrypt handles paths, files, build versus make etc. Does this problem still exist with TS >= 3.7.6?
Happens to me on fresh tarball extract of 3.7.16. I Point my PATH to transrypt folder, so I can issue command as: run_transcrypt -nm test.py
Here is my full stack trace.
hiren@hiren-Lenovo-E50-70 ~/Downloads/Transcrypt-3.7.16/transcrypt $ ./run_transcrypt
Could not find mypy
Transcrypt (TM) Python to JavaScript Small Sane Subset Transpiler Version 3.7.16 Copyright (C) Geatec Engineering. License: Apache 2.0
Saving target code in: /home/hiren/Downloads/Transcrypt-3.7.16/transcrypt/target/org.transcrypt.runtime.js Saving minified target code in: /home/hiren/Downloads/Transcrypt-3.7.16/transcrypt/target/org.transcrypt.runtime.js
list index out of rangeTraceback (most recent call last): File "/home/hiren/Downloads/Transcrypt-3.7.16/transcrypt/modules/org/transcrypt/compiler.py", line 98, in init self.provide (self.mainModuleName, 'main') File "/home/hiren/Downloads/Transcrypt-3.7.16/transcrypt/modules/org/transcrypt/compiler.py", line 120, in provide return Module (self, moduleName, moduleName, filter) File "/home/hiren/Downloads/Transcrypt-3.7.16/transcrypt/modules/org/transcrypt/compiler.py", line 129, in init self.findPaths (filter) File "/home/hiren/Downloads/Transcrypt-3.7.16/transcrypt/modules/org/transcrypt/compiler.py", line 314, in findPaths message = '\n\tImport error, can't find any of:\n\t\t{}\n'.format ('\n\t\t'. join (self.program.searchedModulePaths)) org.transcrypt.utils.Error: <unprintable Error object>
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "./main.py", line 171, in main compiler.Program (transpilationDirs, symbols, envir) File "/home/hiren/Downloads/Transcrypt-3.7.16/transcrypt/modules/org/transcrypt/compiler.py", line 102, in init message = f'\n\t{exception}' File "/home/hiren/Downloads/Transcrypt-3.7.16/transcrypt/modules/org/transcrypt/utils.py", line 212, in str result += '\n\tFile '{}', line {}, namely:'.format (str (program.importStack [-1][0] .name), self.lineNr) IndexError: list index out of range
Aborted
I get this same error w/ Transcrypt 3.7.16 default pip-installed into Ubuntu 20.04
transcrypt -b -c -da autotest
Transcrypt (TM) Python to JavaScript Small Sane Subset Transpiler Version 3.7.16
Copyright (C) Geatec Engineering. License: Apache 2.0
Saving target code in: /home/user/__target__/org.transcrypt.__runtime__.js
Saving minified target code in: /home/user/__target__/org.transcrypt.__runtime__.js
list index out of rangeTraceback (most recent call last):
File "/home/user/.local/lib/python3.8/site-packages/transcrypt/modules/org/transcrypt/compiler.py", line 98, in __init__
self.provide (self.mainModuleName, '__main__')
File "/home/user/.local/lib/python3.8/site-packages/transcrypt/modules/org/transcrypt/compiler.py", line 120, in provide
return Module (self, moduleName, __moduleName__, filter)
File "/home/user/.local/lib/python3.8/site-packages/transcrypt/modules/org/transcrypt/compiler.py", line 129, in __init__
self.findPaths (filter)
File "/home/user/.local/lib/python3.8/site-packages/transcrypt/modules/org/transcrypt/compiler.py", line 313, in findPaths
raise utils.Error (
org.transcrypt.utils.Error: <unprintable Error object>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/.local/lib/python3.8/site-packages/transcrypt/__main__.py", line 171, in main
compiler.Program (transpilationDirs, __symbols__, __envir__)
File "/home/user/.local/lib/python3.8/site-packages/transcrypt/modules/org/transcrypt/compiler.py", line 102, in __init__
message = f'\n\t{exception}'
File "/home/user/.local/lib/python3.8/site-packages/transcrypt/modules/org/transcrypt/utils.py", line 212, in __str__
result += '\n\tFile \'{}\', line {}, namely:'.format (str (program.importStack [-1][0] .name), self.lineNr)
IndexError: list index out of range
Aborted