Thumby Code Editor Issues

DarkGizmo

  • Jr. Member
  • **
    • Posts: 8
    • View Profile
Hello everyone,

I haven't yet received my thumby, but I am already starting a project in the Thumby Code Editor

It's a great tool but I  have some questions that I couldn't find any answer online
I'm still learning Python after years of using C++, so maybe some of these are related to my lack of Python knowledge

  • I want to create a new file in my project, but can't seem to be able to add a new file, when  I import a file from PC, it switches the current tab to the new file, so I lose this particular file. Am I missing something? I have a work-around, but it is clearly a weird and convoluted way to add a new file to the project. I have a feeling it might be due to the fact that I work Thumby-less
  • I rather like working with binary files for my sprite data, but for some reason sometime the editor seems to lose a reference to one of my .bin file. I get "OSError: [Errno 2] ENOENT" on a line where I load the file. I made sure the file was there with the emulated check and it was. If I remove the line loading the file everything works and then later I can bring it back and it works. Then sometime later it might stop working with no change around this particular line or file or logic... I tried refreshing the Code Editor, but it didn't fix it
  • The import sprite tool is great and that's mostly what I used to create my sprite binary files. The Bitmap Builder is a quick and easy tool to use, but it seems both can't be used together and that's a shame. It'd be great to be able to import binary files, modify the data and then re-export in binary. Is that something that's being considered?
  • I might be missing something, but I haven't seen anything about outputting in the shell in the Code Editor? Without a debugger outputting to shell would be great, I've seen somewhere that you can write to file, but without an actual Thumby that doesn't seem to be feasible?

Thank you
I'm already having a great time and haven't received my Thumby yet. Can't wait to see how small it actually is!


Jason

  • Administrator
  • Full Member
  • *****
    • Posts: 41
  • TinyCircuits Employee
    • View Profile
These are issues that we are working on addressing. In the meantime,

  • Use Utilities -> Widgets -> + Editor (this should be a simple + icon in the future)
  • Make sure to check the white emulation box on the sprite data file and that it's path is where you expect (hover over the file tab)
  • Bitmap Builder and the sprite importer will likely be combined at some point
  • You can write to a file in the emulator but it will not be there the next time it starts. You can print to the shell from hardware or the emulator using print() (a standard Python function)


DarkGizmo

  • Jr. Member
  • **
    • Posts: 8
    • View Profile
Make sure to check the white emulation box on the sprite data file and that it's path is where you expect (hover over the file tab)

Yes it should good, is there a limit on the number of character of a filename? Or a limit of file the emulator can support?


DarkGizmo

  • Jr. Member
  • **
    • Posts: 8
    • View Profile
I've created a empty main.py that only loads a file. Doesn't seem to work with my .spr file, but works with the same file if it's a .bin file.
Am I missing something? Is the extension part of my issue?

Code: [Select]
print("Open file")
with open("/player_idle_10x11_x2.spr",'rb') as animFile:
    print("hello")

Outputs:
>>> __import__('/main')
Open file
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/main.py", line 6, in <module>
OSError: [Errno 2] ENOENT

while

Code: [Select]
print("Open file")
with open("/player_idle_10x11_x2.bin",'rb') as animFile:
    print("hello")

Outputs:
>>> __import__('/main')
Open file
hello
<module '/main' from '/main.py'>

Same file content just the extension was changed

If I run os.listdir() I get a variable number of files depending of which file I have emulated or not

['animation.py',
'background.py',
'character.py',
'collectible_12x10_x18_sprite.bin',
'collision_manager.py',
'game_framework.py',
'key.py',
'labyrinth.py',
'lib',
'main.py',
'player.py',
'player_idle_10x11_x2_mask.bin']

if I remove from emulation this file "player_idle_10x11_x2_mask.bin", then I get this list, which seems to be all my files, except this one...-

['animation.py',
'background.py',
'character.py',
'collectible_12x10_x18_sprite.bin',
'collision_manager.py',
'game_framework.py',
'key.py',
'labyrinth.py',
'lib',
'main.py',
'player.py',
'player_idle_10x11_x2_sprite.bin',
'player_walk_10x11_x3_mask.bin',
'player_walk_10x11_x3_sprite.bin']

So my guess is renaming the file to .bin or .spr changes the order and affects the files somehow. Has anyone seen something like this? I'm not sure if I'm doing something wrong or something weird is happening outside of my control
« Last Edit: April 25, 2022, 11:32:19 PM by DarkGizmo »


DarkGizmo

  • Jr. Member
  • **
    • Posts: 8
    • View Profile
I feel more and more that's it's an emulator issue, I keep listing my files every execution. Sometime a file is missing and just with code changes it reappears.

On the emulator page, there is a list of files, are all those file supposed to be accessible, because it seems to fit all my files that are set to emulate (the white checkmark). But not all of them are available when the emulator is started?

Anyone has any pointer for this issue? I'm thinking of migrating all my data to a python .py file so I don't have to fight this issue, but it just doesn't feel right


Jason

  • Administrator
  • Full Member
  • *****
    • Posts: 41
  • TinyCircuits Employee
    • View Profile
I feel more and more that's it's an emulator issue, I keep listing my files every execution. Sometime a file is missing and just with code changes it reappears.

On the emulator page, there is a list of files, are all those file supposed to be accessible, because it seems to fit all my files that are set to emulate (the white checkmark). But not all of them are available when the emulator is started?

Anyone has any pointer for this issue? I'm thinking of migrating all my data to a python .py file so I don't have to fight this issue, but it just doesn't feel right

I agree that it sounds like an emulator issue.

I may have time to look at it soon.


 

SMF spam blocked by CleanTalk