inventree / InvenTree

Open Source Inventory Management System
https://docs.inventree.org
MIT License
4.19k stars 754 forks source link

Scan Barcode #3129

Closed SchrodingersGat closed 2 years ago

SchrodingersGat commented 2 years ago

Discussed in https://github.com/inventree/InvenTree/discussions/3126

Originally posted by **lookme2** June 3, 2022 I'm not sure this is a bug or not. So I thought I would start here. After updating to 7.0 and trying to scan a barcode I get "Server error" The question is do I have something setup wrong? I seem to remember something about this moving to a plug in but cant seem to find that in the docs Frankie
SchrodingersGat commented 2 years ago

@lookme2 you should be able to view the error message in the admin view: https://inventree.readthedocs.io/en/latest/settings/logs/

Can you please post the error message here?

yes I have updated to 0.7.0 and when I scan via the web page I get "Server error" back. The scan does not work.

Are you using the main barcode scanning view from the navbar? And using the USB scanner functionality, or the "scan via webcam" feature?

lookme2 commented 2 years ago

@SchrodingersGat I am away from the server until Friday. I will post the log file then.

lookme2 commented 2 years ago

@SchrodingersGat here is what I see as the error from the admin page.

Environment:

Request Method: POST Request URL: ...../api/barcode/

Django Version: 3.2.13 Python Version: 3.8.10 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'user_sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.sites', 'maintenance_mode', 'build.apps.BuildConfig', 'common.apps.CommonConfig', 'company.apps.CompanyConfig', 'label.apps.LabelConfig', 'order.apps.OrderConfig', 'part.apps.PartConfig', 'report.apps.ReportConfig', 'stock.apps.StockConfig', 'users.apps.UsersConfig', 'plugin.apps.PluginAppConfig', 'InvenTree.apps.InvenTreeConfig', 'django_filters', 'rest_framework', 'rest_framework.authtoken', 'corsheaders', 'crispy_forms', 'import_export', 'django_cleanup.apps.CleanupConfig', 'mptt', 'markdownx', 'markdownify', 'django_admin_shell', 'djmoney', 'djmoney.contrib.exchange', 'error_report', 'django_q', 'formtools', 'allauth', 'allauth.account', 'allauth.socialaccount', 'django_otp', 'django_otp.plugins.otp_totp', 'django_otp.plugins.otp_static', 'allauth_2fa', 'sslserver'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'x_forwarded_for.middleware.XForwardedForMiddleware', 'user_sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'InvenTree.middleware.InvenTreeRemoteUserMiddleware', 'django_otp.middleware.OTPMiddleware', 'InvenTree.middleware.CustomAllauthTwoFactorMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'InvenTree.middleware.AuthRequiredMiddleware', 'InvenTree.middleware.Check2FAMiddleware', 'maintenance_mode.middleware.MaintenanceModeMiddleware', 'error_report.middleware.ExceptionProcessor']

Traceback (most recent call last): File "/home/prism/Inventory/inventree-env/lib/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch response = handler(request, *args, kwargs) File "/home/prism/Inventory/InvenTree-0.7.0/InvenTree/plugin/base/barcodes/api.py", line 59, in post plugins.append(InvenTreeBarcodePlugin()) File "/home/prism/Inventory/InvenTree-0.7.0/InvenTree/plugin/base/barcodes/mixins.py", line 46, in init super().init() File "/home/prism/Inventory/InvenTree-0.7.0/InvenTree/plugin/plugin.py", line 224, in init self.define_package() File "/home/prism/Inventory/InvenTree-0.7.0/InvenTree/plugin/plugin.py", line 336, in define_package package = self._get_package_metadata() if self._is_package else self._get_package_commit() File "/home/prism/Inventory/InvenTree-0.7.0/InvenTree/plugin/plugin.py", line 324, in _get_package_commit return get_git_log(self.def_path) File "/home/prism/Inventory/InvenTree-0.7.0/InvenTree/plugin/helpers.py", line 112, in get_git_log output = str(subprocess.check_output(command, cwd=os.path.dirname(settings.BASE_DIR)), 'utf-8')[1:-1] File "/usr/lib/python3.8/subprocess.py", line 415, in check_output return run(popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.8/subprocess.py", line 493, in run with Popen(popenargs, kwargs) as process: File "/usr/lib/python3.8/subprocess.py", line 858, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename)

Exception Type: FileNotFoundError at /api/barcode/ Exception Value: [Errno 2] No such file or directory: 'git'

SchrodingersGat commented 2 years ago

Are you running in docker, or a "bare metal" install?

matmair commented 2 years ago

@lookme2 git is missing on the system - curious that this point is reached. Could you: A) install git B) post the Version Information?

lookme2 commented 2 years ago

Version Information:

InvenTree-Version: 0.7.0 Django Version: 3.2.13

Database: sqlite3 Debug-Mode: True Deployed using Docker: False

@matmair this was working fine until I updated to 0.7.0. I will install git.

matmair commented 2 years ago

@lookme2 is it working now?

SchrodingersGat commented 2 years ago

@lookme2 I think this should be sorted now, please let us know if installing git did not fix the issue.