Closed yapnel closed 4 years ago
I have created a simple test.zip with two python files inside (main.py and config.py). The main.py importing config.py file and have the args defined. It is throwing error as per below complaining No Module Config found. I have attached the zip file for your reviewing. Kindly please advise how to resolve this issue. Thanks,
Error while trying exception-catch method on C:\Temp\bitbucket\wooey\ProjectName\ProjectName\user_uploads\wooeyscripts\test.zip: Traceback (most recent call last): File "C:\Temp\bitbucket\wooey\env\lib\site-packages\clinto\parsers\argparse.py", line 226, in extract_parser 'file': self.script_path, File "
", line 2, in ModuleNotFoundError: No module named 'config' Error while loading C:\Temp\bitbucket\wooey\ProjectName\ProjectName\user_uploads\wooeyscripts\test.zip: Traceback (most recent call last): File "C:\Temp\bitbucket\wooey\env\lib\site-packages\clinto\parsers\argparse.py", line 241, in extract_parser module = imp.load_source('name', self.script_path) File "C:\Program Files\Python37\lib\imp.py", line 171, in load_source module = _load(spec) File " ", line 696, in _load File " ", line 677, in _load_unlocked File " ", line 724, in exec_module File " ", line 860, in get_code File " ", line 791, in source_to_code File " ", line 219, in _call_with_frames_removed ValueError: source code string cannot contain null bytes
Hi @yapnel,
Thank you for your example. It looks like the initial version of zip file parsing didn't properly support relative imports inside the zipped asset. You have 2 options: 1) Wait for this to be fixed 2) Defer the import (though this is supposed to be handled by the AST parser).
Also, I think you may be using an older version of wooey/clinto, as your stacktrace doesn't line up with the latest in clinto. Can I get your pip freeze
output? And could you try this with an up to date version?
Hi @Chris7
Many thanks for coming back to me.
1) When do you think the fix will be made available? I'm more than happy to assist with the testing if required.
2) Do i defer after the main function in my example? like this
if __name__== "__main__": main() import config
I have just installed the version of Wooey with pip install wooey. I assume it should install all the latest packages. Below is the list of package versions.
amqp==2.5.2 appdirs==1.4.3 asgiref==3.2.7 attrs==19.3.0 beautifulsoup4==4.9.0 billiard==3.6.3.0 cached-property==1.5.1 celery==4.4.2 certifi==2020.4.5.1 cffi==1.14.0 chardet==3.0.4 clinto==0.3.0 colored==1.4.2 cx-Oracle==7.2.3 defusedxml==0.6.0 Django==3.0.5 django-autoslug==1.9.7 django-celery-results==1.2.1 django-storages==1.9.1 dnspython==1.16.0 entrypoints==0.3 eventlet==0.25.2 Gooey==1.0.3 greenlet==0.4.15 idna==2.9 importlib-metadata==1.6.0 isodate==0.6.0 jsonfield==2.1.1 keyring==19.2.0 kombu==4.6.8 ldap3==2.6.1 lxml==4.5.0 monotonic==1.5 numpy==1.18.3 Pillow==7.1.1 psutil==5.7.0 pyasn1==0.4.8 pycparser==2.20 pypiwin32==223 pytz==2019.3 pywin32==225 pywin32-ctypes==0.2.0 requests==2.23.0 requests-toolbelt==0.9.1 six==1.14.0 soupsieve==2.0 SQLAlchemy==1.3.16 sqlparse==0.3.1 tableauhyperapi==0.0.10002 tableauserverclient==0.9 urllib3==1.24.3 vine==1.3.0 wooey==0.12.0 wxPython==4.0.7.post2 zeep==3.4.0 zipp==3.1.0
Thanks for your pip freeze.
The fix might take me a week or so. I am fairly busy with work at the moment (I'm in the life sciences and go back and forth in extremes w/ covid19 efforts at the moment).
With respect to deferring the imports, it was importing those functions in the functions that utilize them. For instance:
def main():
import a
do_something_with_a
Hi
I have a python program that imports other modules into it. It is complaining the module not found when i'm adding the script. How do i resolve this problem? OR Wooey only expects a standalone script only?
Example of my program import structure main.py -- a.py -- b.py -- c.py
thanks.