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

TypeError on all uploads #7895

Closed
perecanet opened this issue Nov 7, 2023 · 3 comments
Closed

TypeError on all uploads #7895

perecanet opened this issue Nov 7, 2023 · 3 comments
Assignees

Comments

@perecanet
Copy link

CKAN version

2.10.1

Describe the bug

Whenever I upload a resource, I get this error: TypeError: '>' not supported between instances of 'int' and 'str'
I tried with many docs and different formats but I get the same error.

Additional details

2023-11-07 14:28:29,824 ERROR [ckan.config.middleware.flask_app] '>' not supported between instances of 'int' and 'str'
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/flask/app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python3.10/site-packages/flask/app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/usr/lib/python3.10/site-packages/flask/views.py", line 84, in view
return current_app.ensure_sync(self.dispatch_request)(*args, **kwargs)
File "/usr/lib/python3.10/site-packages/flask/views.py", line 158, in dispatch_request
return current_app.ensure_sync(meth)(*args, **kwargs)
File "/srv/app/src/ckan/ckan/config/middleware/../../views/resource.py", line 253, in post
get_action(u'resource_create')(context, data)
File "/srv/app/src/ckan/ckan/logic/init.py", line 551, in wrapped
result = _action(context, data_dict, **kw)
File "/srv/app/src/ckan/ckan/logic/action/create.py", line 342, in resource_create
upload.upload(package.resources[-1].id,
File "/srv/app/src/ckan/ckan/lib/uploader.py", line 338, in upload
_copy_file(self.upload_file, output_file, max_size)
File "/srv/app/src/ckan/ckan/lib/uploader.py", line 39, in _copy_file
if current_size > max_size:
TypeError: '>' not supported between instances of 'int' and 'str'

@kowh-ai
Copy link
Contributor

kowh-ai commented Nov 14, 2023

Can you please add some more information...is the a new installation? What platform are you on?...

@MarkNITC
Copy link

MarkNITC commented Nov 16, 2023

I have the same issue. Step to reproduce:

Default new installation, upload works fine.

Define CKAN_MAX_UPLOAD_SIZE_MB=100 as environment variable and all uploads fail.

Stacktrace:
ckan | File "/srv/app/src/ckan/ckan/lib/uploader.py", line 338, in upload
ckan | _copy_file(self.upload_file, output_file, max_size)
ckan | File "/srv/app/src/ckan/ckan/lib/uploader.py", line 39, in _copy_file
ckan | if current_size > max_size:
ckan | TypeError: '>' not supported between instances of 'int' and 'str'

So, this variable is interpreted as a string (which is normal for env. variables), but not converted to int and that's why the comparison fails.

@smotornyuk
Copy link
Member

This was fixed in #7502 and will be available in the next patch release (v2.10.2)

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

Successfully merging a pull request may close this issue.

4 participants