Jaseci-Labs / jaclang

The Jac Programming Language
https://www.jac-lang.org
22 stars 21 forks source link

Error while running Jac lang program - according to the guide #195

Closed musab-mah-7 closed 8 months ago

musab-mah-7 commented 8 months ago

Operating System: Windows 11 Jac Lang Version: 0.4.7

Description: I followed the installation guide at [link to the guide: https://www.jac-lang.org/learn/guide/] for Jac lang, and I encountered an error when trying to run my program.

Steps to Reproduce:

  1. Installed Jac lang following the guide mentioned above.
  2. Created a Jac lang program as described in the guide.
  3. Attempted to run the program using the command: [jac run test.jac].

The error message is as follows: image image

`ERROR - test.jac, line 1, col 1: Syntax Error: Unexpected token Token('FSTR_SQ_PIECE', 'ÿþ"\x00"\x00"\x00E\x00n\x00u\x00m\x00 \x00f\x00o\x00r\x00 \x00s\x00h\x00a\x00p\x00e\x00 \x00t\x00y\x00p\x00e\x00s\x00"\x00"\x00"\x00\n\x00\n\x00e\x00n\x00u\x00m\x00 \x00S\x00h\x00a\x00p\x00e\x00T\x00y\x00p\x00e\x00 \x00') at line 1, column 1. Expected one of:

Traceback (most recent call last): File "/home/musab/.local/bin/jac", line 8, in <module> sys.exit(start_cli()) File "/home/musab/.local/lib/python3.10/site-packages/jaclang/cli/cli.py", line 120, in start_cli ret = command.call(**args) File "/home/musab/.local/lib/python3.10/site-packages/jaclang/cli/cmdreg.py", line 40, in call return self.func(*args, **kwargs) File "/home/musab/.local/lib/python3.10/site-packages/jaclang/cli/cli.py", line 26, in run __jac_import__( File "/home/musab/.local/lib/python3.10/site-packages/jaclang/compiler/importer.py", line 54, in jac_import if error := transpile_jac(full_target): File "/home/musab/.local/lib/python3.10/site-packages/jaclang/compiler/transpiler.py", line 15, in transpile_jac code = jac_file_to_pass( File "/home/musab/.local/lib/python3.10/site-packages/jaclang/compiler/transpiler.py", line 34, in jac_file_to_pass jac_str=file.read(), File "/usr/lib/python3.10/codecs.py", line 322, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

musab-mah-7 commented 8 months ago

I found a solution to the issue. The problem was related to the Python version; upgrading it to at least 3.11 resolved the issue. Additionally, when copy-pasting from Windows from a guide, use Shift+Ctrl+V for pasting as plain text, instead of the standard Ctrl+V.

This distinction is important because Ctrl+V in Windows may include formatting or other metadata, whereas Shift+Ctrl+V pastes as plain text without additional formatting.

marsninja commented 8 months ago

Thanks for looking into this @musab-mah-7 !!