1

I'm trying to use this python library in my website. Now, I've downloaded the sc2reader-0.6.5-py3.3.egg file and transferred the sc2reader folder in some random directory on my FTP account. I've also created files called test.py and test.php in the same directory. Test.php executes the test.py, and test.py imports the sc2reader library.

This is the code in the test.py:

import sys
import sc2reader
print 'Works'

And it doesn't run, if I remove the second line (import sc2reader), it runs just fine.

The directory structure looks like this:

/random_dir
L________/sc2reader
         L_____ __init__.py
         L______/other_stuff
L________test.py
L________test.php

Any help is much appreciated. :P

WarSensation
  • 84
  • 2
  • 11
  • Is there an error message (e.g. in your web server logs)? Can you run you python script from the command line? What are the permissions on sc2reader? You might want to see what goes out to stderr - see http://stackoverflow.com/questions/2320608/php-stderr-after-exec – AMADANON Inc. Jun 19 '14 at 01:56

2 Answers2

0

From the docs of sc2reader:

Install from the latest release on PyPI with pip:

pip install sc2reader

or easy_install:

easy_install sc2reader

The egg file you downloaded is meant to be installed using easy_install. You can do this by running:

easy_install sc2reader-0.6.5-py3.3.egg.

I would recommend just installing with pip under virtualenv. That way, when Python or a library you use is updated, your environment doesn't change with them and your application will continue to work.

Community
  • 1
  • 1
mkorcha
  • 171
  • 1
  • 11
0

Looks to me like sc2reader is not in your PYTHONPATH. Open Python, without the quotes, type 'import sys' then 'sys.path'. Put sc2reader in one of the paths listed and see if it runs.