Issue #14 resolved
Mark created an issue

I have been getting an error when I try to submit the last line of the following code, even though PythonInR seems to be working fine for other simple procedures:

pyConnect()
pyExec("import boto3")
pyExec("import pandas as pd")
pyExec("from boto3.dynamodb.conditions import Key")
pyExecp('mykey="mykeyhere"')
pyExecp('mysecret="mysecretkeyhere"')
pyExecp('myregion="myawsregionhere"')

pyExecp('dynamodb = boto3.resource("dynamodb",aws_access_key_id=mykey,aws_secret_access_key=mysecret,region_name=myregion)')

The error I get is as follows:

> pyExecp('dynamodb = boto3.resource("dynamodb",aws_access_key_id=mykey,aws_secret_access_key=mysecret,region_name=myregion)')
Error in pyExecp("dynamodb = boto3.resource(\"dynamodb\",aws_access_key_id=mykey,aws_secret_access_key=mysecret,region_name=myregion)") : 

   Traceback (most recent call last):
     File "<string>", line 1, in <module>
     File "C:\Users\<MyUserID>\AppData\Local\Programs\Python\Python36\lib\site-packages\boto3\__init__.py", line 92, in resource
       return _get_default_session().resource(*args, **kwargs)
     File "C:\Users\<MyUserID>\AppData\Local\Programs\Python\Python36\lib\site-packages\boto3\session.py", line 389, in resource
       aws_session_token=aws_session_token, config=config)
     File "C:\Users\<MyUserID>\AppData\Local\Programs\Python\Python36\lib\site-packages\boto3\session.py", line 263, in client
       aws_session_token=aws_session_token, config=config)
     File "C:\Users\<MyUserID>\AppData\Local\Programs\Python\Python36\lib\site-packages\botocore\session.py", line 829, in create_client
       loader, endpoint_resolver, self.user_agent(), event_emitter,
     File "C:\Users\<MyUserID>\AppData\Local\Programs\Python\Python36\lib\site-packages\botocore\session.py", line 477, in user_agent
       platform.python_version(),
> 

where <MyUserID> is my actual Windows 10 Pro (x64) User Account ID. Here are my R version details:

platform       "x86_64-w64-mingw32"          
arch           "x86_64"                      
os             "mingw32"                     
system         "x86_64, mingw32"             
status         ""                            
major          "3"                           
minor          "4.0"                         
year           "2017"                        
month          "04"                          
day            "21"                          
svn rev        "72570"                       
language       "R"                           
version.string "R version 3.4.0 (2017-04-21)"
nickname       "You Stupid Darkness"   

Any ideas?

Comments (7)

  1. Florian Schwendinger repo owner

    I would try to compare sys.path start your Python and do

    import sys
    sys.path
    

    and compare it with what you see in

    pyExecp("sys.path")
    

    if there is something missing on the R side just add it.

    This is the first thing which comes to my mind but it is just a guess.

  2. Mark reporter

    Thanks for the prompt reply, Floridan. Can you provide an example or a reference on how to add anything that might be missing on the R side? I have a few items that are missing, but I'm not sure how to properly add them using PythonInR. For example, I'm missing 'C:\Users\<Username>\Miniconda3\lib\site-packages' on the R side. How would I go about adding this? Thank you, in advance for you help.

    PS. I love this package by the way!

  3. Florian Schwendinger repo owner

    Thank you!

    sys.path is a list so you can just append things

    pyExecp("sys.path")
    pyExec("sys.path.append('C:/Users/<Username>/Miniconda3/lib/site-packages')")
    

    I don't know how the rest of your path looks so if you want to use \ instead of / you most likely have to do it like this.

    pyExec("sys.path.append('C:\\\\Users\\\\<Username>\\\\Miniconda3\\\\lib\\\\site-packages')")
    
  4. Mark reporter

    So I modified my sys.path to be exactly like the one I have running in python directly, but I see receive the same error as above unfortunately. Any other ideas or is this a bug of some sort?

  5. Mark reporter

    OK, So I uninstalled the miniconda distribution of python and installed the default python distribution and this seemed to fix this issue. This can probably be closed, unless you wanted to examine why this didn't work on miniconda.

  6. Florian Schwendinger repo owner

    Thank you!

    It would be interesting but most likely hard to reproduce. So I will just close it.

  7. Log in to comment