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

Allow alternatives to default suds file cache #4

Closed
kil opened this issue May 11, 2015 · 5 comments
Closed

Allow alternatives to default suds file cache #4

kil opened this issue May 11, 2015 · 5 comments

Comments

@kil
Copy link

kil commented May 11, 2015

The suds client instantiated at https://github.com/bing-ads-sdk/BingAds-Python-SDK/blob/master/bingads/service_client.py#L250-L252 uses the default suds caching strategy and file location (thats /tmp/suds, where the /tmp part comes from gettempdir()).

That means if two users run this test program:

from bingads import ServiceClient
#EOF

the one that comes second will see this error:

Traceback (most recent call last):
  File "bin/python", line 146, in <module>
    exec(compile(__file__f.read(), __file__, "exec"))
  File "a.py", line 1, in <module>
    from bingads import ServiceClient
  File "/x/eggs/bingads-9.3.2-py2.7.egg/bingads/__init__.py", line 3, in <module>
    from .service_client import *
  File "/x/eggs/bingads-9.3.2-py2.7.egg/bingads/service_client.py", line 251, in <module>
    'file:///' + pkg_resources.resource_filename('bingads', 'proxies/campaign_management_service.xml')
  File "/x/eggs/suds_jurko-0.6-py2.7.egg/suds/client.py", line 112, in __init__
    kwargs["cache"] = ObjectCache(days=1)
  File "/x/eggs/suds_jurko-0.6-py2.7.egg/suds/cache.py", line 119, in __init__
    self.checkversion()
  File "/x/eggs/suds_jurko-0.6-py2.7.egg/suds/cache.py", line 242, in checkversion
    self.clear()
  File "/x/eggs/suds_jurko-0.6-py2.7.egg/suds/cache.py", line 211, in clear
    for fn in os.listdir(self.location):
OSError: [Errno 13] Permission denied: '/tmp/suds'

Would be great if that was configurable (eg. if it was possible to provide the cache argument to the suds client).

@freiz
Copy link
Contributor

freiz commented May 12, 2015

Thanks for reporting this!

This is basically a design flaw of suds-jurko (0.6.0), the development branch of suds-jurko 0.7.0 has fixed this problem, you can read the change log here https://bitbucket.org/jurko/suds, before the suds-jurko 0.7.0 release, We can first take a work around for this problem, and give a solution for this problem in the next release of bingads.

@kil
Copy link
Author

kil commented May 12, 2015

Thank you for looking into this, i would really appreciate it if you guys could provide a work around until when or if there is an update to suds-jurko.

@imagineful
Copy link
Contributor

currently no plan to fix it. close issue. Thanks.

@duijf
Copy link

duijf commented Mar 14, 2018

This is causing issues on our production systems. We spawn a reasonable amount of processes that require this library and the amount of stuff that is being written to disk just by importing ServiceClient is ridiculous, especially as there is no easy way to disable this behavior.

Please reconsider fixing this.

Ugly workaround for people getting to this issue (only use if you never require any caching)

import suds.cache


class UglyNoCache(suds.cache.NoCache):
    def __init__(self, location=None, **duration):
        print("Ugly hack to monkeypatch bing ads's import defaults")


suds.cache.ObjectCache = UglyNoCache

@EamonnONeill
Copy link

Thanks @duijf !

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

5 participants