Repository: conda/conda

Issue:
Installing ompython-2.0.7
Current conda install:

```
           platform : osx-64
      conda version : 4.2.7
   conda is private : False
  conda-env version : 4.2.7
conda-build version : not installed
     python version : 2.7.12.final.0
   requests version : 2.11.1
   root environment : /Library/Frameworks/Python.framework/Versions/2.7  (writable)
default environment : /Library/Frameworks/Python.framework/Versions/2.7
   envs directories : /Library/Frameworks/Python.framework/Versions/2.7/envs
      package cache : /Library/Frameworks/Python.framework/Versions/2.7/pkgs
       channel URLs : https://repo.continuum.io/pkgs/free/osx-64/
                      https://repo.continuum.io/pkgs/free/noarch/
                      https://repo.continuum.io/pkgs/pro/osx-64/
                      https://repo.continuum.io/pkgs/pro/noarch/
        config file : None
       offline mode : False
```

`$ /Library/Frameworks/Python.framework/Versions/2.7/bin/conda install -c mutirri ompython=2.0.7`

```
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/conda/exceptions.py", line 472, in conda_exception_handler
    return_value = func(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/conda/cli/main.py", line 144, in _main
    exit_code = args.func(args, p)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/conda/cli/main_install.py", line 80, in execute
    install(args, parser, 'install')
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/conda/cli/install.py", line 420, in install
    raise CondaRuntimeError('RuntimeError: %s' % e)
CondaRuntimeError: Runtime error: RuntimeError: Invalid mode: <conda.install.FileMode object at 0x10846b110>
```

Installing ompython-2.0.7
Current conda install:

```
           platform : osx-64
      conda version : 4.2.7
   conda is private : False
  conda-env version : 4.2.7
conda-build version : not installed
     python version : 2.7.12.final.0
   requests version : 2.11.1
   root environment : /Library/Frameworks/Python.framework/Versions/2.7  (writable)
default environment : /Library/Frameworks/Python.framework/Versions/2.7
   envs directories : /Library/Frameworks/Python.framework/Versions/2.7/envs
      package cache : /Library/Frameworks/Python.framework/Versions/2.7/pkgs
       channel URLs : https://repo.continuum.io/pkgs/free/osx-64/
                      https://repo.continuum.io/pkgs/free/noarch/
                      https://repo.continuum.io/pkgs/pro/osx-64/
                      https://repo.continuum.io/pkgs/pro/noarch/
        config file : None
       offline mode : False
```

`$ /Library/Frameworks/Python.framework/Versions/2.7/bin/conda install -c mutirri ompython=2.0.7`

```
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/conda/exceptions.py", line 472, in conda_exception_handler
    return_value = func(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/conda/cli/main.py", line 144, in _main
    exit_code = args.func(args, p)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/conda/cli/main_install.py", line 80, in execute
    install(args, parser, 'install')
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/conda/cli/install.py", line 420, in install
    raise CondaRuntimeError('RuntimeError: %s' % e)
CondaRuntimeError: Runtime error: RuntimeError: Invalid mode: <conda.install.FileMode object at 0x10846b110>
```



Discussion:
Same here when trying to go through 30-minute tutorial:

```

Current conda install:

               platform : linux-64
          conda version : 4.2.9
       conda is private : False
      conda-env version : 4.2.9
    conda-build version : not installed
         python version : 2.7.12.final.0
       requests version : 2.7.0
       root environment : /home/andrews/miniconda2  (writable)
    default environment : /home/andrews/miniconda2
       envs directories : /home/andrews/miniconda2/envs
          package cache : /home/andrews/miniconda2/pkgs
           channel URLs : https://repo.continuum.io/pkgs/free/linux-64/
                          https://repo.continuum.io/pkgs/free/noarch/
                          https://repo.continuum.io/pkgs/pro/linux-64/
                          https://repo.continuum.io/pkgs/pro/noarch/
            config file : None
           offline mode : False



`$ /home/andrews/miniconda2/bin/conda create --name snowflakes biopython`




    Traceback (most recent call last):
      File "/home/andrews/miniconda2/lib/python2.7/site-packages/conda/exceptions.py", line 473, in conda_exception_handler
        return_value = func(*args, **kwargs)
      File "/home/andrews/miniconda2/lib/python2.7/site-packages/conda/cli/main.py", line 144, in _main
        exit_code = args.func(args, p)
      File "/home/andrews/miniconda2/lib/python2.7/site-packages/conda/cli/main_create.py", line 68, in execute
        install(args, parser, 'create')
      File "/home/andrews/miniconda2/lib/python2.7/site-packages/conda/cli/install.py", line 420, in install
        raise CondaRuntimeError('RuntimeError: %s' % e)
    CondaRuntimeError: Runtime error: RuntimeError: Invalid mode: <conda.install.FileMode object at 0x7f6d7d6deb10>

```

Try installing it through pip. I only tried it through conda because the pip install leads to a problem with omcidl stubs version on Mac OS X. 
Let me know if that works on Linux.

I just went the second time through the tutorial and did not update conda with 'conda update conda'. So conda  version is 4.1.11. This time it works. Looks like a regression.

But does it work? Do you get an error message omniidl stubs version incompatibility (version 4.2 installed, version 3.0 supported)?

I did not use omniidl, notice that my command is different - it is one from http://conda.pydata.org/docs/test-drive.html

I don’t mean the conda part, I mean when you eventually run it in a python program and put “omc=OMCSession()”? Does it work?
On 19 Oct 2016, at 9:05 PM, Andrew Skiba <notifications@github.com<mailto:notifications@github.com>> wrote:

I did not use omniidl, notice that my command is different - it is one from http://conda.pydata.org/docs/test-drive.html

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/conda/conda/issues/3646#issuecomment-254806374, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AVyiz7rRO2UrdQ253bmn20cHOSOlVLWUks5q1hWUgaJpZM4KYLf4.

I don't use ompython either. So far I progress through the tutorial I referred in the previous message, works as expected with conda 4.1.11.

Same here when trying to go through 30-minute tutorial:

```

Current conda install:

               platform : linux-64
          conda version : 4.2.9
       conda is private : False
      conda-env version : 4.2.9
    conda-build version : not installed
         python version : 2.7.12.final.0
       requests version : 2.7.0
       root environment : /home/andrews/miniconda2  (writable)
    default environment : /home/andrews/miniconda2
       envs directories : /home/andrews/miniconda2/envs
          package cache : /home/andrews/miniconda2/pkgs
           channel URLs : https://repo.continuum.io/pkgs/free/linux-64/
                          https://repo.continuum.io/pkgs/free/noarch/
                          https://repo.continuum.io/pkgs/pro/linux-64/
                          https://repo.continuum.io/pkgs/pro/noarch/
            config file : None
           offline mode : False



`$ /home/andrews/miniconda2/bin/conda create --name snowflakes biopython`




    Traceback (most recent call last):
      File "/home/andrews/miniconda2/lib/python2.7/site-packages/conda/exceptions.py", line 473, in conda_exception_handler
        return_value = func(*args, **kwargs)
      File "/home/andrews/miniconda2/lib/python2.7/site-packages/conda/cli/main.py", line 144, in _main
        exit_code = args.func(args, p)
      File "/home/andrews/miniconda2/lib/python2.7/site-packages/conda/cli/main_create.py", line 68, in execute
        install(args, parser, 'create')
      File "/home/andrews/miniconda2/lib/python2.7/site-packages/conda/cli/install.py", line 420, in install
        raise CondaRuntimeError('RuntimeError: %s' % e)
    CondaRuntimeError: Runtime error: RuntimeError: Invalid mode: <conda.install.FileMode object at 0x7f6d7d6deb10>

```

Try installing it through pip. I only tried it through conda because the pip install leads to a problem with omcidl stubs version on Mac OS X. 
Let me know if that works on Linux.

I just went the second time through the tutorial and did not update conda with 'conda update conda'. So conda  version is 4.1.11. This time it works. Looks like a regression.

But does it work? Do you get an error message omniidl stubs version incompatibility (version 4.2 installed, version 3.0 supported)?

I did not use omniidl, notice that my command is different - it is one from http://conda.pydata.org/docs/test-drive.html

I don’t mean the conda part, I mean when you eventually run it in a python program and put “omc=OMCSession()”? Does it work?
On 19 Oct 2016, at 9:05 PM, Andrew Skiba <notifications@github.com<mailto:notifications@github.com>> wrote:

I did not use omniidl, notice that my command is different - it is one from http://conda.pydata.org/docs/test-drive.html

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/conda/conda/issues/3646#issuecomment-254806374, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AVyiz7rRO2UrdQ253bmn20cHOSOlVLWUks5q1hWUgaJpZM4KYLf4.

I don't use ompython either. So far I progress through the tutorial I referred in the previous message, works as expected with conda 4.1.11.


Resolving patch:
diff --git a/conda/install.py b/conda/install.py
--- a/conda/install.py
+++ b/conda/install.py
@@ -281,7 +281,7 @@ def replace(match):
 
 
 def replace_long_shebang(mode, data):
-    if mode is FileMode.text:
+    if mode == FileMode.text:
         shebang_match = SHEBANG_REGEX.match(data)
         if shebang_match:
             whole_shebang, executable, options = shebang_match.groups()
@@ -350,7 +350,7 @@ def replace_pyzzer_entry_point_shebang(all_data, placeholder, new_prefix):
 
 
 def replace_prefix(mode, data, placeholder, new_prefix):
-    if mode is FileMode.text:
+    if mode == FileMode.text:
         data = data.replace(placeholder.encode(UTF8), new_prefix.encode(UTF8))
     elif mode == FileMode.binary:
         data = binary_replace(data, placeholder.encode(UTF8), new_prefix.encode(UTF8))
@@ -360,7 +360,7 @@ def replace_prefix(mode, data, placeholder, new_prefix):
 
 
 def update_prefix(path, new_prefix, placeholder=PREFIX_PLACEHOLDER, mode=FileMode.text):
-    if on_win and mode is FileMode.text:
+    if on_win and mode == FileMode.text:
         # force all prefix replacements to forward slashes to simplify need to escape backslashes
         # replace with unix-style path separators
         new_prefix = new_prefix.replace('\\', '/')


Test patch: