Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Error: Location '$PWD/radish' to load modules does not exist" on Windows during running features #221

Closed
Freudenberger opened this issue Mar 21, 2018 · 11 comments

Comments

@Freudenberger
Copy link

Following the instruction from:
http://radish.readthedocs.io/en/latest/installation.html
and
http://radish.readthedocs.io/en/latest/quickstart.html
instead of running the tests with command
radish features/
an error occurs:

Error: Location '$PWD/radish' to load modules does not exist

Traceback (most recent call last):
  File "d:\workspace\radishSample\venv\lib\site-packages\radish\errororacle.py", line 52, in _decorator
    return func(*args, **kwargs)
  File "d:\workspace\radishSample\venv\lib\site-packages\radish\main.py", line 206, in main
    return method(core)
  File "d:\workspace\radishSample\venv\lib\site-packages\radish\main.py", line 65, in run_features
    load_modules(basedir)
  File "d:\workspace\radishSample\venv\lib\site-packages\radish\loader.py", line 20, in load_modules
    raise OSError("Location '{0}' to load modules does not exist".format(location))
OSError: Location '$PWD/radish' to load modules does not exist

According to https://github.com/radish-bdd/radish - it should be possible to run it on Windows without any modifications.

Tested with following versions:

radish-bdd (0.8.3)
radish-parse-type (0.3.5)

OS:

OS Name	Microsoft Windows 10 Pro, 64-bit
Version	10.0.16299 Build 16299

Python:
Python 3.6.4, 32-bit

@paul-divine
Copy link

paul-divine commented Apr 4, 2018

It seems that in the utils module the flattened_basedirs(basedirs) function split on the ':' character,
which is on windows the separator of the drive letter (example D:dir1).
Here is a workaround, you can put the calculator module in the same directory as steps.py and use the -b option (radish features -b radish).
The workaround was tested with Python version 2.7.13 and radish -version 0.8.3.
Here are the details.

>ls radish
calculator.py  steps.py  terrain.py  
>ls  features
SumNumbers.feature
>cat radish/calculator.py
 # -*- coding: utf-8 -*

class Calculator(object):
    def __init__(self, caching=True):
        " init "
        pass
    def add(self, xxx, yyy):
        " addition "
        return xxx + yyy
    def sub(self, xxx, yyy):
        " substraction "
        return xxx - yyy
    def mult(self, xxx, yyy):
        " multiply "
        return xxx * yyy
    def div(self, xxx, yyy):
        " divide "
        return xxx / yyy

>radish features -b radish
Feature: The calculator should be able to sum numbers  # features\SumNumbers.feature
    In order to make sure the calculator
    sums numbers correctly I have the following
    test scenarios:

    Scenario: Test my calculator
        Given I have the numbers 5 and 6
        Given I have the numbers 5 and 6
        When I sum them
        When I sum them
        Then I expect the result to be 11
        Then I expect the result to be 11

1 features (1 passed)
1 scenarios (1 passed)
3 steps (3 passed)
Run 1522821946 finished within a moment

@timofurrer
Copy link
Member

Thanks for explanation @paul-divine
Unfortunately, I don't have access to a Windows environment.
PR to keep radish Windows compatible are always welcome!

@timofurrer
Copy link
Member

For now, please use -b or multiple times -b.
As explained above, I don't have access to a windows to test this right now. However, I'm always happy to review PRs.

@7ep
Copy link

7ep commented Feb 6, 2019

I am encountering this issue as well. If this is fixed, I'd love to know about it.

@fliiiix
Copy link
Member

fliiiix commented Feb 6, 2019

@7ep can you share the versions you are using? (radish, python, etc.)

@timofurrer timofurrer reopened this Feb 6, 2019
@timofurrer timofurrer added this to the 1.0.0 milestone Feb 6, 2019
@7ep
Copy link

7ep commented Feb 6, 2019

Radish version: 0.10.0
Python 3.7
Windows 10

@fliiiix
Copy link
Member

fliiiix commented Feb 7, 2019

I reproduced this issue, fix will follow hopefully this week.

@fliiiix fliiiix self-assigned this Feb 7, 2019
timofurrer added a commit that referenced this issue Feb 9, 2019
Fix #221 flattened_basedirs on Windows by ; instead of :
@vrbcntrl
Copy link

I am also getting the same error on my windows 10 machine...
I have radish v 0.13.1
Pls let me know if there is a fix for this issue...thanks in advance!

@fliiiix
Copy link
Member

fliiiix commented Jun 30, 2019

This issue here was fixed.
So my guess is you are trying to run radish without -b basedir.

So when you provide no basedir it only works for Linux. But I create a pr to create a similar behavior on windows: #354

@vrbcntrl
Copy link

vrbcntrl commented Jul 1, 2019

Hi @fliiiix ,

I actually tried with -b parameter also

C:\Training\radish-bdd>radish -b C:\Users\vrb.cntrl\AppData\Local\Programs\Python\Python37\Lib\site-packages features/

and I got the below error:


C:\Training\radish-bdd>radish -b C:\Users\vrb.cntrl\AppData\Local\Programs\Python\Python37\Lib\site-packages features/
C:\Users\vrb.cntrl\AppData\Local\Programs\Python\Python37\lib\site-packages\botocore\vendored\requests\packages\urllib3\_collections.py:1: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Mapping, MutableMapping
C:\Users\vrb.cntrl\AppData\Local\Programs\Python\Python37\lib\site-packages\botocore\vendored\requests\packages\urllib3\_collections.py:1: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Mapping, MutableMapping
Error: Unable to import module 'session' from 'C:\Users\vrb.cntrl\AppData\Local\Programs\Python\Python37\Lib\site-packages\boto3\session.py': attempted relative import with no known parent package

Traceback (most recent call last):
  File "C:\Users\vrb.cntrl\AppData\Local\Programs\Python\Python37\lib\site-packages\radish\loader.py", line 43, in load_module
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\vrb.cntrl\AppData\Local\Programs\Python\Python37\Lib\site-packages\boto3\session.py", line 25, in <module>
    from .resources.factory import ResourceFactory
ImportError: attempted relative import with no known parent package

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\vrb.cntrl\AppData\Local\Programs\Python\Python37\lib\site-packages\radish\errororacle.py", line 61, in _decorator
    return func(*args, **kwargs)
  File "C:\Users\vrb.cntrl\AppData\Local\Programs\Python\Python37\lib\site-packages\radish\main.py", line 221, in main
    return method(core)
  File "C:\Users\vrb.cntrl\AppData\Local\Programs\Python\Python37\lib\site-packages\radish\main.py", line 67, in run_features
    load_modules(basedir)
  File "C:\Users\vrb.cntrl\AppData\Local\Programs\Python\Python37\lib\site-packages\radish\loader.py", line 26, in load_modules
    load_module(os.path.join(p, filename))
  File "C:\Users\vrb.cntrl\AppData\Local\Programs\Python\Python37\lib\site-packages\radish\loader.py", line 53, in load_module
    "Unable to import module '{0}' from '{1}': {2}".format(module_name, path, e)
ImportError: Unable to import module 'session' from 'C:\Users\vrb.cntrl\AppData\Local\Programs\Python\Python37\Lib\site-packages\boto3\session.py': attempted relative import with no known parent package


C:\Training\radish-bdd>

@fliiiix
Copy link
Member

fliiiix commented Jul 2, 2019

site-packages isn't your radish base directory. Checkout: https://github.com/radish-bdd/radish/tree/master/tests/exploratory/basic

For example there your base directory is radish so you would run:

radish -b radish feature/SumNumbers.feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants