Giter Club home page Giter Club logo

Comments (6)

wesleybl avatar wesleybl commented on June 19, 2024

This is related to #4129. The buildout generates the following code for the entry point:

import robot.run

if __name__ == '__main__':
    sys.exit(robot.run.run_cli())

Then the above error occurs when running the script.

I don't think changing the way the entry point is written would solve the problem. I think what would solve it would be to eliminate the confusion of "run" in both types of import. Of course the buildout could be wrong too, but that doesn't invalidate this issue here.

cc @choeger

from robotframework.

wesleybl avatar wesleybl commented on June 19, 2024

but could you not switch the entry points to use the root module directly?

humm @choeger' suggestion works. If the entry point is changed to:

'robot = robot:run_cli'

The script generated by buildout would be:

import robot

if __name__ == '__main__':
    sys.exit(robot.run_cli())

and it would work.

from robotframework.

pekkaklarck avatar pekkaklarck commented on June 19, 2024

This is due to the robot root module having both a run sub module and a run function. This isn't great design but there are historical reasons for it.

The run module exists to allow running Robot like python -m robot.run. That's not too relevant nowadays when python -m robot works, but that wasn't possible back in Python 2.6 days.

The run function is there just to have a convenient API for running Robot programmatically. I believe it was added after the run module was introduced and could have been named differently, but run felt (and feels) like a good name for this purpose and the function and the module having the same name didn't seem to cause problems.

To resolve the issue, we needed to rename either the module or the function. As I wrote otherwise, python -m robot.run usage isn't that important anymore, so I believe renaming the module would be a better idea. That would, however, be a backwards incompatible change causing issues for anyone possibly still using python -m robot.run or importing anything from the robot.run module. I'm not sure the change worth the problems it would cause.

from robotframework.

wesleybl avatar wesleybl commented on June 19, 2024

@pekkaklarck I think it should be renamed because it causes confusion. But if it's going to cause a lot of trouble, could you at least change the entry point to work with buildout?

from robotframework.

pekkaklarck avatar pekkaklarck commented on June 19, 2024

Do you mean that in our setup.py we should change 'robot = robot.run:run_cli' to 'robot = robot:run_cli'? That sounds fine, but I'm slightly worried about possible side-effects and believe it would be safer to do that in RF 7.1 than in 7.0.1.

from robotframework.

wesleybl avatar wesleybl commented on June 19, 2024

Do you mean that in our setup.py we should change 'robot = robot.run:run_cli' to 'robot = robot:run_cli'?

Yes. Remembering that the other entrypoints will require the same change.

That sounds fine, but I'm slightly worried about possible side-effects and believe it would be safer to do that in RF 7.1 than in 7.0.1.

The run module will continue to exist. So I don't see a problem with making this change in 7.0.1. I don't see anything breaking. I think it's a safe change to make.

But in any case, changing the module name cannot be lost sight of. Maybe in an 8.0 version?

from robotframework.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.