dansanderson / picotool

Tools and Python libraries for manipulating Pico-8 game files. http://www.lexaloffle.com/pico-8.php
MIT License
367 stars 46 forks source link

P8tool can't seem to write files #99

Open KyleNeubarth opened 2 years ago

KyleNeubarth commented 2 years ago

Hi, I've just setup picotool but any command that tries to create a file seems to be failing. I've followed the installation instructions exactly, but I get the following traceback whenever I try to run the build or write commands.

FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\kyle\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\pico8\\game\\empty_023.p8.png'  

My python is version 3.10.2, pip is version 22.0.4 and picotool itself. I'm running picotool on Windows 10.

Has anyone else run into this issue? Or perhaps there is another reason why picotool is failing to write temporary files in its package directory?

dansanderson commented 2 years ago

Possibly fixed by https://github.com/dansanderson/picotool/pull/90 , I'll try to get this merged in.

KyleNeubarth commented 2 years ago

So, I added the one line modified mentioned in the PR and now the error is based on not passing a string to the bytes() function. Wondering if perhaps I'm doing something else wrong here? I've included the whole stack trace, apologies if it's a bit long.

Traceback (most recent call last): File "C:\Users\kyle\AppData\Local\Programs\Python\Python310\Scripts\p8tool-script.py", line 33, in sys.exit(load_entry_point('p8tool==0.1', 'console_scripts', 'p8tool')()) File "C:\Users\kyle\AppData\Local\Programs\Python\Python310\lib\site-packages\pico8\tool.py", line 625, in main return args.func(args) File "C:\Users\kyle\AppData\Local\Programs\Python\Python310\lib\site-packages\pico8\build\build.py", line 302, in do_build file.to_file( File "C:\Users\kyle\AppData\Local\Programs\Python\Python310\lib\site-packages\pico8\game\file.py", line 90, in to_file fmt.to_file(game, outfh, filename=filename, *args, **kwargs) File "C:\Users\kyle\AppData\Local\Programs\Python\Python310\lib\site-packages\pico8\game\formatter\p8png.py", line 275, in to_file code_bytes = get_bytes_from_code(b''.join(cart_lua)) File "C:\Users\kyle\AppData\Local\Programs\Python\Python310\lib\site-packages\pico8\game\formatter\p8png.py", line 159, in get_bytes_from_code code_bytes = bytes(code, 'ascii') TypeError: encoding without a string argument

KyleNeubarth commented 2 years ago

The command that caused this error is as follows, main.lua is a file which only contains "print("hello world!")".

p8tool build test.p8.png --lua ./source/main.lua