Skip to content

NameError: name 'sys' is not defined when running generated project example #75

@benbrastmckie

Description

@benbrastmckie

Bug Description

After generating a new logos-project and choosing to test an example, the program fails with NameError: name 'sys' is not defined.

Environment

  • OS: macOS (Darwin 24.6.0)
  • Python: 3.13
  • model-checker version: 1.1.0
  • Installation method: pip3 install model-checker

Steps to Reproduce

  1. Install model-checker: pip3 install model-checker
  2. Run: model-checker
  3. When prompted "Would you like to generate a new logos-project? (y/n):", enter: y
  4. Enter a project name (e.g., "new")
  5. When prompted "Would you like to test an example in your project? (y/n):", enter: y

Expected Behavior

The example should run successfully, demonstrating the model-checker functionality.

Actual Behavior

The program fails with the following error:

◆ Documents ❯❯❯ model-checker
Would you like to generate a new logos-project? (y/n): y
Enter the name of your project using snake_case: new

Project generated at: /Users/nicky/Documents/project_new

Project structure:
└── project_new/
    ├── .modelchecker
    ├── CITATION.md
    ├── LICENSE.md
    ├── README.md
    ├── TODO.md
    ├── __init__.py
    ├── examples.py
    ├── iterate.py
    ├── operators.py
    ├── semantic.py
    ├── docs/
    │   ├── API_REFERENCE.md
    │   ├── ARCHITECTURE.md
    │   ├── ITERATE.md
    │   ├── README.md
    │   ├── SETTINGS.md
    │   └── USER_GUIDE.md
    ├── subtheories/
    │   ├── README.md
    │   ├── __init__.py
    │   ├── constitutive
    │   ├── counterfactual
    │   ├── extensional
    │   ├── modal
    │   └── relevance
    └── tests/
        ├── README.md
        ├── __init__.py
        ├── conftest.py
        ├── integration
        └── unit
Would you like to test an example in your project? (y/n): y

Running example: /Users/nicky/Documents/project_new/examples.py

Unexpected error: name 'sys' is not defined
You can run it manually with: model-checker /Users/nicky/Documents/project_new/examples.py

Root Cause

The generated examples.py file appears to be missing an import sys statement, or there's an issue with how the example is being executed that prevents the sys module from being available.

Additional Context

This issue occurs immediately after project generation, suggesting the template files may have missing imports or there's an execution environment issue. The project structure is generated correctly, but the example execution fails.

Suggested Investigation

  1. Check the contents of the generated examples.py file for missing imports
  2. Verify the execution context when running examples
  3. Ensure all necessary imports are included in template files

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions