Sublime Forum

Sublime running error

#1

When i try to run some python code it throws me an error,

Traceback (most recent call last):
File “C:\Users\Lenovo\AppData\Local\Programs\Python\Python36\lib\runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “C:\Users\Lenovo\AppData\Local\Programs\Python\Python36\lib\runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “C:\Users\Lenovo\AppData\Local\Programs\Python\Python36\lib\py_compile.py”, line 186, in
sys.exit(main())
File “C:\Users\Lenovo\AppData\Local\Programs\Python\Python36\lib\py_compile.py”, line 178, in main
compile(filename, doraise=True)
File “C:\Users\Lenovo\AppData\Local\Programs\Python\Python36\lib\py_compile.py”, line 122, in compile
source_bytes = loader.get_data(file)
File “”, line 832, in get_data
FileNotFoundError: [Errno 2] No such file or directory: ‘’
[Finished in 0.2s]

Can i get help on this?

Thanks

0 Likes

#2

Make sure you save your Python code to a file on disk before you try to run it.

0 Likes

#3

I tried to run a simple code as i am starting off with it.
I saved the file as python file and executed in sublime then too I get this error,
‘Traceback (most recent call last):
File “C:\Users\Lenovo\AppData\Local\Programs\Python\Python36\lib\runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “C:\Users\Lenovo\AppData\Local\Programs\Python\Python36\lib\runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “C:\Users\Lenovo\AppData\Local\Programs\Python\Python36\lib\py_compile.py”, line 186, in
sys.exit(main())
File “C:\Users\Lenovo\AppData\Local\Programs\Python\Python36\lib\py_compile.py”, line 178, in main
compile(filename, doraise=True)
File “C:\Users\Lenovo\AppData\Local\Programs\Python\Python36\lib\py_compile.py”, line 122, in compile
source_bytes = loader.get_data(file)
File “”, line 832, in get_data
FileNotFoundError: [Errno 2] No such file or directory: “C:\Program Files (x86)\Sublime Text 3\print(‘hello’).py”
[Finished in 0.2s]’

Thanks for replying

0 Likes

#4

Under no circumstances should you ever save a file into the location where Sublime is installed (or any application); you should be using a location somewhere in your Documents folder.

Apart from that, that filename may not be valid.

0 Likes

#5

Thank you so much. It runs perfect now.
You are great help for a starter like me.

0 Likes