Skip to content

Conversation

@MostlyKIGuess
Copy link
Member

  • Fixes reading activity.info with 'b[ at the start.

@quozl
Copy link
Contributor

quozl commented Feb 5, 2025

Does look strange. Couldn't find the problem being solved. If we have any info files that start with strange content, we should change the files.

@MostlyKIGuess
Copy link
Member Author

Does look strange. Couldn't find the problem being solved. If we have any info files that start with strange content, we should change the files.

Yeah so this was really weird as well and I am not sure why it's happening either, I will share a video on this error on the byte character being present.

@quozl
Copy link
Contributor

quozl commented Feb 6, 2025

No video required, just describe how to reproduce.

@MostlyKIGuess
Copy link
Member Author

No video required, just describe how to reproduce.

  • Installing the current head of the toolkit branch.
  • Trying to install hello-world we get:
❯ sugar-activity3 activity.HelloWorldActivity
Traceback (most recent call last):
  File "/usr/local/bin/sugar-activity3", line 5, in <module>
    activityinstance.main()
    ~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/sugar3/activity/activityinstance.py", line 130, in main
    bundle = ActivityBundle(bundle_path)
  File "/usr/lib/python3.13/site-packages/sugar3/bundle/activitybundle.py", line 122, in __init__
    self._parse_info(info_file)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/sugar3/bundle/activitybundle.py", line 136, in _parse_info
    cp.read_file(info_file)
    ~~~~~~~~~~~~^^^^^^^^^^^
  File "/usr/lib/python3.13/configparser.py", line 756, in read_file
    self._read(f, source)
    ~~~~~~~~~~^^^^^^^^^^^
  File "/usr/lib/python3.13/configparser.py", line 1050, in _read
    ParsingError._raise_all(self._read_inner(fp, fpname))
                            ~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/usr/lib/python3.13/configparser.py", line 1079, in _read_inner
    self._handle_rest(st, line, fpname)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/configparser.py", line 1107, in _handle_rest
    raise MissingSectionHeaderError(fpname, st.lineno, line)
configparser.MissingSectionHeaderError: File contains no section headers.
file: '/home/mostlyk/Documents/GitHub/hello-world/activity/activity.info', line: 1
"b'[Activity]\\n'"
  • Fixing it to this branch it fixes this error.

@MostlyKIGuess
Copy link
Member Author

No video required, just describe how to reproduce.

* Installing the current head of the toolkit branch.

* Trying to install hello-world we get:
❯ sugar-activity3 activity.HelloWorldActivity
Traceback (most recent call last):
  File "/usr/local/bin/sugar-activity3", line 5, in <module>
    activityinstance.main()
    ~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/sugar3/activity/activityinstance.py", line 130, in main
    bundle = ActivityBundle(bundle_path)
  File "/usr/lib/python3.13/site-packages/sugar3/bundle/activitybundle.py", line 122, in __init__
    self._parse_info(info_file)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/sugar3/bundle/activitybundle.py", line 136, in _parse_info
    cp.read_file(info_file)
    ~~~~~~~~~~~~^^^^^^^^^^^
  File "/usr/lib/python3.13/configparser.py", line 756, in read_file
    self._read(f, source)
    ~~~~~~~~~~^^^^^^^^^^^
  File "/usr/lib/python3.13/configparser.py", line 1050, in _read
    ParsingError._raise_all(self._read_inner(fp, fpname))
                            ~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/usr/lib/python3.13/configparser.py", line 1079, in _read_inner
    self._handle_rest(st, line, fpname)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/configparser.py", line 1107, in _handle_rest
    raise MissingSectionHeaderError(fpname, st.lineno, line)
configparser.MissingSectionHeaderError: File contains no section headers.
file: '/home/mostlyk/Documents/GitHub/hello-world/activity/activity.info', line: 1
"b'[Activity]\\n'"
* Fixing it to this branch it fixes this error.

Some commands which might make the process easier:

sudo ./autogen.sh;sudo make clean;sudo make;sudo make install
 sudo rm -rf /usr/lib/python3.13/site-packages/sugar3;sudo cp -r ./src/sugar3 /usr/lib/python3.13/site-packages/sugar3

@quozl
Copy link
Contributor

quozl commented Feb 6, 2025

And the contents and sha256sum of the file?

@MostlyKIGuess
Copy link
Member Author

And the contents and sha256sum of the file?

the activity info of hello world you mean?

@quozl
Copy link
Contributor

quozl commented Feb 6, 2025

Oh, I have that repository, but I'm asking you to take the sha256sum of the file with the path in the error message on your affected system.

@MostlyKIGuess
Copy link
Member Author

Oh, I have that repository, but I'm asking you to take the sha256sum of the file with the path in the error message on your affected system.

❯ sha256sum ./activity/activity.info

5b9cfdb1dd93f3f1166a980b50ccc017059de3066017458cd2ca3009806fe4d3  ./activity/activity.info

@quozl
Copy link
Contributor

quozl commented Feb 6, 2025

Thanks, same here. I've used Python REPL to read the activity.info file using configparser, and don't get the same result. I think you need to dig deeper into why this is happening, rather than look for b'. I think your fix is to the wrong place.

@MostlyKIGuess
Copy link
Member Author

Thanks, same here. I've used Python REPL to read the activity.info file using configparser, and don't get the same result. I think you need to dig deeper into why this is happening, rather than look for b'. I think your fix is to the wrong place.

Hmm but isn't this is where we read activity info?
Were you able to get the same error?

@quozl
Copy link
Contributor

quozl commented Feb 9, 2025

I've dug deeper for you. Bundle.get_file in bundle.py is preparing to read the file using 'rb' passed to open.

ActivityBundle._parse_info is giving the iterable to ConfigParser.read_file.

Yet ConfigParser.read_file documentation says the iterable must yield Unicode strings, "for example files opened in text mode".

So this regression is introduced by your a3f9d76 which changed cp.read_string(linfo_file.read().decode()) into cp.read_file(info_file).

I've pushed revert as 4ef8a87.

@quozl quozl closed this Feb 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants