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

Find pip cross platform without environment variable #674

Merged

Conversation

LexiconCode
Copy link
Member

@LexiconCode LexiconCode commented Aug 12, 2019

Description

This pull request sys.exec_prefix to find pip or pip.exe path.
@Versatilus partial credit goes to utilizing sys.exec_prefix which inspired this fix.

Related Issue

@alexboche reported in gitter.

  | Exception from starting subprocess [None, 'search', 'dragonfly2']: argument of type 'NoneType' is not iterable
--|--
  | Error loading _caster from C:\Users\alex\Documents\Caster-master\_caster.py
  | Traceback (most recent call last):
  | File "C:\NatLink\NatLink\MacroSystem\core\natlinkmain.py", line 331, in loadFile
  | imp.load_module(modName,fndFile,fndName,fndDesc)
  | File "C:\Users\alex\Documents\Caster-master\_caster.py", line 72, in <module>
  | class MainRule(MergeRule):
  | File "C:\Users\alex\Documents\Caster-master\_caster.py", line 90, in MainRule
  | R(DependencyUpdate([pip_path, "install", "--upgrade", "castervoice"])),
  | File "C:\Python27\lib\site-packages\dragonfly\actions\action_cmd.py", line 168, in __init__
  | self._str = "'%s'" % " ".join(self.command)
  | TypeError: sequence item 0: expected string, NoneType found

Motivation and Context

sys.exec_prefix to find pip or pip.exe path instead of relying on windows environmental variable Python path. action_cmd without the path for PIP leading to above error. In addition this function is cross-platform.

How Has This Been Tested

  • This has been tested by removing the Python path from windows environmental variables then restarting Windows.
  • function tested on linux.
  • function tested on Python 3.

Types of changes

  • Bug fix (non-breaking change which fixes an issue or bug)

Checklist

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • I have checked that my code does not duplicate functionality elsewhere in Caster.
  • My code implements all the features I wish to merge in this pull request.
  • All new and existing tests pass.

Maintainer/Reviewer Checklist

  • Basic functionality has been tested and works as claimed.
  • Code is clear and readable.

@LexiconCode LexiconCode added the Bug Unexpected behavior from existing features. label Aug 12, 2019
@LexiconCode LexiconCode self-assigned this Aug 12, 2019
@LexiconCode LexiconCode force-pushed the find_pip_cross-platform branch from 9bd48ea to f2b2f1f Compare August 12, 2019 23:52
@LexiconCode LexiconCode merged commit 73a5d19 into dictation-toolbox:master Aug 12, 2019
@LexiconCode LexiconCode deleted the find_pip_cross-platform branch August 12, 2019 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Unexpected behavior from existing features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant