IronLanguages / IronLanguages/ironpython3

Exception on using example in GITHUB encoding 850

Open
#1,569 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
2.8k
Forks
316
Avg merge
1d 9h
Merged PRs (30d)
1

Description

Prerequisites

The issue tracker is used to report bugs and request new features, NOT to ask questions.

Questions should be posted to the users mailing list which can be accessed at
https://ironpython.groups.io/g/users.

  • [ X] Are you running the latest version?
  • Are you reporting to the correct repository?
  • [X ] Did you perform a cursory search?
Description

System.Reflection.TargetInvocationException: 'Failed to load language 'IronPython 3.4.0b1': No data is available for encoding 850. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.'

Steps to Reproduce
  1. Console app either NET6 or NET CORE 3.1

  2. System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); //UNSUCCESSFUL TRY adding this.

  3. The code:
    public class Program
    {
    static void Main(string[] args)
    {

         var eng = IronPython.Hosting.Python.CreateEngine();
         var scope = eng.CreateScope();
         eng.Execute(@"
             def greetings(name):
                 return 'Hello ' + name.title() + '!'
             ", scope);
         dynamic greetings = scope.GetVariable("greetings");
         System.Console.WriteLine(greetings("world"));
     }
    

    }

Expected behavior:

Shot the greeting in console

Actual behavior:

TargetInvocationException

Versions

IronPython 3.4.0b1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the .NET console reproduction using IronPython.Hosting.Python.CreateEngine and the CodePagesEncodingProvider registration, then investigate where loading IronPython 3.4.0b1 requests encoding 850. Done means the supplied greetings example runs on .NET 6 or .NET Core 3.1 and prints the expected greeting without a TargetInvocationException.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.