Skip to content

Can't name a parameter "filename"? #20

@Seanny123

Description

@Seanny123

On Windows 10, I can't seem to change the "filename" parameter in the following script.

import pytry

class Simple(pytry.Trial):
    def params(self):
        self.param('first number', x=1)
        self.param('second number', y=1)
        self.param('operation to compute', op='plus')
        self.param('the filename', filename="weights.npz")

    def evaluate(self, p):
        print(p.filename)
        if p.op == 'plus':
            result = p.x + p.y
        if p.op == 'minus':
            result = p.x - p.y

        return dict(result=result)

However, if I change the parameter name to fn everything works fine.

import pytry

class Simple(pytry.Trial):
    def params(self):
        self.param('first number', x=1)
        self.param('second number', y=1)
        self.param('operation to compute', op='plus')
        self.param('the filename', fn="weights.npz")

    def evaluate(self, p):
        print(p.fn)
        if p.op == 'plus':
            result = p.x + p.y
        if p.op == 'minus':
            result = p.x - p.y

        return dict(result=result)

Any ideas why this might be happening?

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