Comments (6)
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.
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.
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.
@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.
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.
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)
- Support common keyword setup / teardown for a file HOT 6
- Robot Listener3 Issue: Adding tags in 'result' works for test case and in 'data' works for user keyword. HOT 1
- `maxerrorlines` does not appear to work via `robot.running.model.TestSuite.run`
- Dictionaries are not accepted as-is in argument conversion with unions containing TypedDicts HOT 4
- `NotRequired` and `Required` not properly handled with Python < 3.11 in `TypedDict` conversion HOT 6
- Add variable file import related method to listener version 3
- Multiple keywords matching: 'User Login Successfully' in 'PageCommonActions'. HOT 3
- Logging HTML doesn't get embedded in the log.html HOT 1
- Creating user keywords with programmatic API HOT 4
- Incorrect syntax in for loop crashes RF and html reports are not generated. HOT 2
- Request to set implicit wait as a basic parameter to a keyword HOT 1
- Multiple imports of library does not create new instance
- Generate Random String fails to create strong password HOT 2
- The on_limit_message for the WHILE loop does not output the correct variable value if the variable is updated inside the loop HOT 2
- Feature request: rebot - Option to embed images in html HOT 4
- Feature request: Log stack trace for each faliure HOT 1
- How to register a customize logger with the robot.output.logger in Robot 7.x HOT 1
- Named-only arguments are not trace logged with user keywords HOT 1
- Collections: Value of `ignore_case` argument accidentally logged HOT 1
- Remove confusing debug statement HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from robotframework.