MarketSquare / MarketSquare/Rammbock

Rammbock install fails on python3

Open
#68 3 comments 3 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
64
Forks
48
PR merge metrics
No merged PRs in 30d

Description

# Steps to Reproduce
On an ubuntu 16.04 LTS installation, open a console. First run ```sudo pip3 install robotframework```.

Then run ```sudo pip3 install robotframework-rammbock```.

Alternatively, download [rammbock version 0.4.0.1 on pypi](https://pypi.python.org/packages/f5/89/9dd436822936c49932047ff224505b30fa6921b246d20f9b2134b81d17ac/robotframework-rammbock-0.4.0.1.tar.gz) then run ```sudo python3 setup.py```

# Expect

```robotframework-rambock``` should install without error.

# Actual
The installation fails with the following outuput:
```bash
$ sudo pip3 install robotframework-rammbock
Collecting robotframework-rammbock
Using cached robotframework-rammbock-0.4.0.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-build-5sjki94c/robotframework-rammbock/setup.py", line 6, in
execfile(join(CURDIR, 'src', 'Rammbock', 'version.py'))
NameError: name 'execfile' is not defined
```

# Recommended solution
Referring to [this question on stack overflow](https://stackoverflow.com/questions/6357361/alternative-to-execfile-in-python-3), I was able to resolve this issue by replacing setup.py:6

```python
execfile(join(CURDIR, 'src', 'Rammbock', 'version.py'))
```

with the following:

```python
filename=join(CURDIR, 'src', 'Rammbock', 'version.py')
exec(compile(open(filename, "rb").read(), filename, 'exec'))
```

## Testing

The discussion on stack overflow suggests that this change is compatible with both python2 and python3. I verified that for both python2 and python3 on my machine using the commands:

```bash
sudo python setup.py
```

```bash
sudo python3 setup.py
```

I'm happy to submit this change as a pull request.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with setup.py line 6 and inspect how src/Rammbock/version.py is loaded during packaging. Verify the change with both `sudo python setup.py` and `sudo python3 setup.py`, then confirm that installing robotframework-rammbock completes without the reported NameError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.