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

seeing errors on the script #5

Closed
dmccullo opened this issue Sep 6, 2017 · 5 comments
Closed

seeing errors on the script #5

dmccullo opened this issue Sep 6, 2017 · 5 comments

Comments

@dmccullo
Copy link

dmccullo commented Sep 6, 2017

ImportError: No module named 'limesurveyrc2api.limesurvey

when I run the test from the test folder at
/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/limesurveyrc2api/tests

config.ini is setup right yet I get nothing at all

dtruss results:

`dtruss python3 tests.py ▸▸▸▸▸▸▸▸▸▸

SYSCALL(args) = return
madvise(0x100298000, 0x3000, 0x5) = 0 0
open("/dev/dtracehelper\0", 0x2, 0x7FFF5FBFE3E0) = 3 0
ioctl(0x3, 0x80086804, 0x7FFF5FBFE368) = 0 0
close(0x3) = 0 0
thread_selfid(0x3, 0x80086804, 0x7FFF5FBFE368) = 1151900 0
bsdthread_register(0x7FFFBFD80080, 0x7FFFBFD80070, 0x2000) = 1073741919 0
ulock_wake(0x1, 0x7FFF5FBFD9BC, 0x0) = -1 Err#2
issetugid(0x1, 0x7FFF5FBFD9BC, 0x0) = 0 0
mprotect(0x100352000, 0x88, 0x1) = 0 0
mprotect(0x100354000, 0x1000, 0x0) = 0 0
mprotect(0x10036A000, 0x1000, 0x0) = 0 0
mprotect(0x10036B000, 0x1000, 0x0) = 0 0
mprotect(0x100381000, 0x1000, 0x0) = 0 0
mprotect(0x100382000, 0x1000, 0x1) = 0 0
mprotect(0x100352000, 0x88, 0x3) = 0 0
mprotect(0x100352000, 0x88, 0x1) = 0 0
getpid(0x100352000, 0x88, 0x1) = 29121 0
stat64("/AppleInternal/XBS/.isChrooted\0", 0x7FFF5FBFD878, 0x1) = -1 Err#2
stat64("/AppleInternal\0", 0x7FFF5FBFD910, 0x1) = -1 Err#2
csops(0x71C1, 0x7, 0x7FFF5FBFD3A0) = -1 Err#22
sysctl([CTL_KERN, 14, 1, 29121, 0, 0] (4), 0x7FFF5FBFD4F8, 0x7FFF5FBFD4F0, 0x0, 0x0) = 0 0
ulock_wake(0x1, 0x7FFF5FBFD920, 0x0) = -1 Err#2
csops(0x71C1, 0x7, 0x7FFF5FBFCC80) = -1 Err#22
getuid(0x71C1, 0x7, 0x7FFF5FBFCC80) = 868336049 0
getuid(0x71C1, 0x7, 0x7FFF5FBFCC80) = 868336049 0
stat64("/\0", 0x7FFF5FBFD8C0, 0x7FFF5FBFCC80) = 0 0
getattrlist("/Library\0", 0x7FFFBFC24B04, 0x7FFF5FBFF1D0) = 0 0
getattrlist("/Library/Frameworks\0", 0x7FFFBFC24B04, 0x7FFF5FBFF1D0) = 0 0
getattrlist("/Library/Frameworks/Python.framework\0", 0x7FFFBFC24B04, 0x7FFF5FBFF1D0) = 0 0
getattrlist("/Library/Frameworks/Python.framework/Versions\0", 0x7FFFBFC24B04, 0x7FFF5FBFF1D0) = 0 0
getattrlist("/Library/Frameworks/Python.framework/Versions/3.5\0", 0x7FFFBFC24B04, 0x7FFF5FBFF1D0) = 0 0
getattrlist("/Library/Frameworks/Python.framework/Versions/3.5/bin\0", 0x7FFFBFC24B04, 0x7FFF5FBFF1D0) = 0 0`
any idea what might be going on?

to be honest I am new to Lime and Lime API's and would appreciate any guidance :-)

@lindsay-stevens
Copy link
Owner

Could you elaborate on what system you're using, how you installed the package, and what you would like to do? To be honest I'm not sure what to make of the error message either - is that a strace output?

How to get started

Assuming you're also new to Python, and can't quite get started, the following is how to. I can't promise to be able to give this level of support in future but anyway here we go.

Start with making a workspace for your project, create a Python virtual environment to keep libraries from clashing across projects, and activate the virtual environment. The following does this with a folder named "lime_test" in your home directory.

Linux:

mkdir -p ~/lime_test
cd ~/lime_test
python3 -m venv venv
source ~/lime_test/venv/bin/activate

Windows:

set "test=%HOMEDRIVE%%HOMEPATH%\lime_test"
mkdir "%test%"
cd "%test%"
C:/Full/Path/To/Your/Python3/python.exe -m venv venv
call "%test%"\venv\Scripts\activate"

Next steps depend on whether you want to work on limesurveyrc2api itself, or just use it in some other project.

Just using it

To just use it, install the package from GitHub, install the requests dependency, and off you go:

pip install https://github.com/lindsay-stevens/limesurveyrc2api/archive/master.zip
pip install requests

Then make a silly script to check imports work OK. Create a file named "my_script.py" with the following contents:

from limesurveyrc2api.limesurvey import LimeSurvey

api = LimeSurvey(url="nothing", username="nothing")

print(api)
print("yep OK")

Then run it:

python my_script.py

Should print out something like this:

<limesurveyrc2api.limesurvey.LimeSurvey object at 0x0000000002859198>
yep OK

Work on LSRC2API

If you want to work on the project, you'll want to clone the repository then install the dependencies in one hit. Assuming you have git on your path, you can clone it into a folder called "repo" like this:

git clone https://github.com/lindsay-stevens/limesurveyrc2api repo

Alternatively, go to the project home page, click "Clone or download" then "Download zip". Unzip that file into your repo folder.

This next step assumes your terminal session from earlier is still open, with the virtual environment still active. You can tell if it is, if the command prompt says "(venv)" at the start.

cd repo
pip install -r requirements.txt

Then you can modify the project, add changes, etc.

Note

If you want to "deactivate" the virtual environment so that you can work on something else, just type "deactivate" and hit Enter.

@dmccullo
Copy link
Author

dmccullo commented Sep 7, 2017

Thanks I will try these today.
dtruss is a strace like tool for OSX
I am running on OS X.

I installed by git clone your project then
CD to the directory.

ran python3 setup.py install

there are several recommendations that may help above I will let you know.

I am migrating several Python scripts that grab data from Fluid surveys to use LimeSurvey as we are migrating off of fluid surveys...

Very little documentations on the Lime survey API LOL

Thanks so much for the quick response!

@dmccullo
Copy link
Author

dmccullo commented Sep 7, 2017

Ok
`from limesurveyrc2api.limesurvey import LimeSurvey

api = LimeSurvey(url="nothing", username="nothing")

print(api)
print("yep OK")`
works

<limesurveyrc2api.limesurvey.LimeSurvey object at 0x10217a278>
yep OK

so off to trying to get the coding done HEHE

do you know of a goo source of details on how the api calls work?

thanks

Don

@lindsay-stevens
Copy link
Owner

No problem. I'll close this one out but feel free to open another for other issues.

For working with the API, check out the references linked in the readme which is everything I'm aware of.

For working with this client library, each API function has a docstring describing the input arguments.

For both, I don't think there's documentation of the data structures you'll get back from API calls, but if you'd like to add that in a PR it'd be welcome.

@dmccullo
Copy link
Author

dmccullo commented Sep 8, 2017

I am working on getting the code worked out!

I would gladly provide some code examples to add to the documentation!

let me know if you would like me to provide details as i work them out :-)

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

No branches or pull requests

2 participants