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

from prices import Price #171

Closed
infinityalgorithms opened this issue Mar 26, 2014 · 41 comments
Closed

from prices import Price #171

infinityalgorithms opened this issue Mar 26, 2014 · 41 comments

Comments

@infinityalgorithms
Copy link

I am getting this error:
ImportError cart: No module named prices

I found the source of the error:
from prices import Price

this line is found on the following files:
https://github.com/mirumee/saleor/blob/25adc3c8e840c81418833290a89e240baf7833e1/saleor/product/models/discounts.py
https://github.com/mirumee/saleor/blob/fcf982842c2ad9f9795efe4b11d9dc3f9a251fba/saleor/product/models/variants.py
https://github.com/mirumee/saleor/blob/214138810c1722f1b61e01c115eeecb362f93fb9/saleor/cart/__init__.py
https://github.com/mirumee/saleor/blob/25adc3c8e840c81418833290a89e240baf7833e1/saleor/order/models.py

and I see that I cannot find this module anywhere as I did do a search. This is preventing me from syncing to the DB and getting this running successfully.

Let me know what is missing as I am still searching.

@patrys
Copy link
Member

patrys commented Mar 26, 2014

Did you follow the setup steps, most importantly python setup.py develop? It seems that you are missing dependencies.

@artursmet
Copy link
Contributor

I've created new virtualenv, cloned current master and executed python setup.py develop after these steps python manage.py syncdb --all works. So I think that you have missing dependencies.

@infinityalgorithms
Copy link
Author

Yes, I attempted to do setup.py though I got an error:

configure: error: in `/tmp/easy_install-aJSds8/pycrypto-2.6.1':
configure: error: cannot run C compiled programs.

and so I tried putting in all the apps one at a time, I got each one and added it to the server.

any thoughts on that C compiled programs error?

@artursmet
Copy link
Contributor

Do you have C++ headers for python installed? Something like python-dev package in Ubuntu

@infinityalgorithms
Copy link
Author

Likely no, though I am attempting to launch this on a webfaction server,

What would be the procedure to install C++ package for python there?

@patrys
Copy link
Member

patrys commented Mar 26, 2014

If your compiler is working, could it be that your /tmp partition is mounted as noexec?

Try pip install prices to get the prices library working.

@artursmet did you recently switch to cpppython? I sure hope they keep maintaining cpython ;)

@infinityalgorithms
Copy link
Author

Yes, I got beyond the price import error, I will continue adapting the apps until they work

Thank you for the lift

@patrys
Copy link
Member

patrys commented Mar 26, 2014

I'll close this issue as it does not require any action from our side but you can keep updating it with questions and we'll do our best to help.

@patrys patrys closed this as completed Mar 26, 2014
@infinityalgorithms
Copy link
Author

from ..order.models import DigitalDeliveryGroup
ValueError: Attempted relative import beyond toplevel package

this error has risen during syncdb command Im assuming its the

"from ..order.models"

and the .. part needs revising?

@patrys
Copy link
Member

patrys commented Mar 26, 2014

I can assure you the paths are correct as both the site and its test suite pass on multiple versions of python: https://travis-ci.org/mirumee/saleor

What exactly are you running to get this error?

@infinityalgorithms
Copy link
Author

python 2.7.5 django 1.6.2
webfaction servers

extra note: I am attempting to install this framework into my existing site ;

Also modifying that path to fit my project worked and I got to the next error:
django.core.exceptions.ImproperlyConfigured: ImportError checkout: cannot import name status_changed

@patrys
Copy link
Member

patrys commented Mar 26, 2014

Looks like you need to pip install django-payments as well?

@infinityalgorithms
Copy link
Author

thats the dilemma with crypto and the C dependencies

@infinityalgorithms
Copy link
Author

What would be the procedure to install C++ package for python there?

@patrys
Copy link
Member

patrys commented Mar 26, 2014

Artur really meant C headers, cpython is (luckily) not written in C++.

Maybe you could look at Webfaction-specific forums for Python help? This looks like a clue: https://community.webfaction.com/questions/12333/pycrypto-import-error

@artursmet
Copy link
Contributor

Look at this: http://docs.webfaction.com/software/python.html#error-permission-denied-during-package-installation
Maybe you have to execute setup.py with customized environmental variables.

@infinityalgorithms
Copy link
Author

This worked:

wget https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.tar.gz
tar -xf pycrypto-2.6.tar.gz
cd pycrypto-2.6
python3.3 setup.py install

then:

pip install django-payments

Next:
into the folder where it installed and moved the "payments" folder app to where i serve my site from

next steps:
configuring paths to be congruent with my folder patterns

@infinityalgorithms
Copy link
Author

Set the paths and now I got the database to sync

@patrys
Copy link
Member

patrys commented Mar 26, 2014

Great to hear that. Seeing as you had to alter the paths it might take some tweaking to get tests to run however I strongly recommend you take that extra step as having a working test suite can be of enormous help when refactoring code. Especially code you did not write in the first place.

@infinityalgorithms
Copy link
Author

Well, after synchronising.. the admin panel looks great..

on the other hand I am now into troubleshooting the functionalities individually:

Im here:
TemplateDoesNotExist at /account/login/
base.html

Im looking through the entire repository and I am not finding the base.html file

@patrys
Copy link
Member

patrys commented Mar 26, 2014

@infinityalgorithms
Copy link
Author

Got it up and running and now I went to test a product, so using the default models of Bags and categories when trying to add a catergory the following errors:

RuntimeError at /admin/product/category/add/
maximum recursion depth exceeded while calling a Python object

@patrys
Copy link
Member

patrys commented Mar 26, 2014

It might be easier for us to help if you included a full stack trace.

@infinityalgorithms
Copy link
Author

@patrys
Copy link
Member

patrys commented Mar 26, 2014

There is something wrong with your Category class. Like if it was decorated twice with @python_2_unicode_compatible.

@infinityalgorithms
Copy link
Author

http://pastebin.com/jEyhZYa2

yes it is there twice

@python_2_unicode_compatible
class Category(MPTTModel):

and again

@python_2_unicode_compatible
class Product(Subtyped, ItemRange):

@patrys
Copy link
Member

patrys commented Mar 26, 2014

No, I meant twice on the same class. Category and Product are separate things. It would be much easier if you first got things to work on your local machine as I suspect some of the problems are a result of merging into an existing project while others are related to WebFaction.

@infinityalgorithms
Copy link
Author

Yes, I am doing this on a production setting to integrate with an existing website, If this succeeds then this, saleor, would be the easiest ecommerce project for django that is boxed together nicely with everything one would need; and integration with existing site would be great I've spent a day with satchmo and lfs each and this one is most promising to reach completion in merging with an existing site and also on webfaction

@infinityalgorithms
Copy link
Author

/lib/python2.7/django/utils/encoding.py in
"""
if six.PY2:
if 'str' not in klass.dict:
raise ValueError("@python_2_unicode_compatible cannot be applied "
"to %s because it doesn't define str()." %
klass.name)
klass.unicode = klass.str
klass.str = lambda self: self.unicode().encode('utf-8') ...
return klass
def smart_text(s, encoding='utf-8', strings_only=False, errors='strict'):
"""
Returns a text object representing 's' -- unicode on Python 2 and str on
Python 3. Treats bytestrings using the 'encoding' codec.
▼ Local vars
Variable Value
self
Error in formatting: maximum recursion depth exceeded while calling a Python object

@patrys
Copy link
Member

patrys commented Mar 26, 2014

Yes, I know what the decorator does but in your case it seems that both __str__ and __unicode__ methods point to the same lambda self: self.unicode().encode('utf-8'). Which Python version is this on?

@infinityalgorithms
Copy link
Author

there is python3.3 in the root and python2.7 is in the django app

so structure is kind of like this:

/
/lib
/lib/python3.3

/apps
/apps/mysite

/apps/mysite/apache2
/apps/mysite/myproject
/apps/mysite/lib
/apps/mysite/bin

/apps/mysite/lib/python2.7

in there is django

in /apps/mysite/myproject is each app from saleor and apps that existed before saleor

@patrys
Copy link
Member

patrys commented Mar 26, 2014

Did you add the entire saleor folder to myproject or just its particular submodules?

@infinityalgorithms
Copy link
Author

the entirety of saleor folder

@infinityalgorithms
Copy link
Author

!
I think so....

@patrys
Copy link
Member

patrys commented Mar 26, 2014

Could you then do a separate checkout of the saleor repository in some other directory and try to run its test suite? You do not need a database for that as the tests do not use the ORM.

@infinityalgorithms
Copy link
Author

There is a folder called utils which I did not upload though Im not sure how to add that in:

I have a feeling that there is where this recursion is going haywire as in that utils folder is .py file that populates those premade models

additional:
I should upload my folder structure into github and run a test? Forgive me as I am not familiar with this

@patrys
Copy link
Member

patrys commented Mar 26, 2014

No, the utils folder is for our internal use for now. You don't need it.

@infinityalgorithms
Copy link
Author

Python Version: 2.7.5

@infinityalgorithms
Copy link
Author

Patrys,

Have you any other considerations?

@patrys
Copy link
Member

patrys commented Mar 26, 2014

Did you try my suggestion above? The one about trying to run the test suite of a clean Saleor clone.

@infinityalgorithms
Copy link
Author

Yes, though I did not manage to get the files linked up correctly

gabalese referenced this issue in vonq/saleor Jun 8, 2021
* Annotating type for channel initially.

* Tests and minor fixes.

* Tweaked getChannel() async/await
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

3 participants