Jump to content

- - - - -

Python - Files

  • Please log in to reply
1 reply to this topic

#1 HappyCalc


    Casio Addict

  • Members
  • PipPipPip
  • 55 posts
  • Gender:Male
  • Location:Germany
  • Interests:Programming, On-Calc Programming(C.Basic), Gaming, Origami, Eating Chocolate

  • Calculators:

Posted 24 November 2021 - 08:36 PM

I recently started coding python on the cg-50. I wanted to create an image viewer and started programming various functions to compute the math behind JPEG.

Originally i thought of coding that in C.Basic, my favorite on-calc-interpreter (thx sentaro21 :D ). But the problem is, C.Basic is not object-oriented and i had to use matrices, byte lists and much code. So I thought I would first code the algorithms in python and then port it to C.Basic. I knew that it is hard to get raw data to python since there is no file access, so I decided to create a C.Basic program that converts my 1,5kb sample image to a python byte-string (.py file) (like data in bad apple). This works fine, but is a very dirty solution.

Randomly, I saw, that python on the calc accepts open() as a function and is also marked blue. I tried multiple thing, but using it does not open a file, throw an exception or anything else, it just returns None. Searching in the internet and the python docs also only shows  it as file open function. Maybe CASIO wanted to add it in  the future or removed the feature, but left a bit there?

open() seems to accept at least 1 argument but does not set a limit.

Maybe someone knows more than me (disassembled the os).

Thanks  :nod:

#2 Lost_Player



  • Members
  • Pip
  • 3 posts

  • Calculators:

Posted 10 April 2022 - 07:31 PM

Hello guys, maybe you can help me.
I have written a programm with Python in TigerJython about Pascall's Triangle and it's working on PC but when I transver it to my Caculator (fx-CG50) and try to run it, it's saying there is a syntax error (invalid syntax). 
Do you know what it could be?
if it helps thats the code:

input_num = int(input("anzahl zeilen:"))
list = []
for n in range(input_num):
    for m in range(1,n):
    if(input_num != 0):
for n in range(input_num):
    print(""*(input_num - n), end = "", sep = "")
    for m in range(0, n + 1):
        print('{0:5}'.format(list[n][m]),end ="", sep ="")


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users