-
Notifications
You must be signed in to change notification settings - Fork 77
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
Executable name for Dramatiq on Windows is "dramatiq.exe" #109
Comments
def _resolve_executable(self, exec_name):
bin_dir = os.path.dirname(sys.executable)
if bin_dir:
return os.path.join(bin_dir, exec_name)
return exec_name The new version of |
I solved the issue by adding to the # fall back to default behaviour (from earlier versions)
return os.path.join(bin_dir, exec_name) Here is the whole method: def _resolve_executable(self, exec_name):
bin_dir = os.path.dirname(sys.executable)
if bin_dir:
for d in [bin_dir, os.path.join(bin_dir, "Scripts")]:
exec_path = os.path.join(d, exec_name)
if os.path.isfile(exec_path):
return exec_path
# fall back to default behaviour (from earlier versions)
# ref https://github.com/Bogdanp/django_dramatiq/issues/109
return os.path.join(bin_dir, exec_name)
return exec_name I tried to write a test, but failed. Would you like me to create a pull request for the method (without tests)? |
I'm confused about why the fallback would fix the problem in this case. |
Not sure I am helping, but I wrote a Django management command with two versions of import os
import sys
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = "Dramatiq - process is stopping #5668"
def _resolve_executable(self, exec_name):
bin_dir = os.path.dirname(sys.executable)
if bin_dir:
for d in [bin_dir, os.path.join(bin_dir, "Scripts")]:
exec_path = os.path.join(d, exec_name)
if os.path.isfile(exec_path):
return exec_path
return exec_name
def _resolve_executable_updated(self, exec_name):
bin_dir = os.path.dirname(sys.executable)
if bin_dir:
for d in [bin_dir, os.path.join(bin_dir, "Scripts")]:
exec_path = os.path.join(d, exec_name)
if os.path.isfile(exec_path):
return exec_path
# fall back to default behaviour (from earlier versions)
# ref https://github.com/Bogdanp/django_dramatiq/issues/109
return os.path.join(bin_dir, exec_name)
return exec_name
def handle(self, *args, **options):
self.stdout.write(f"{self.help}")
executable_name = "dramatiq"
result = self._resolve_executable(executable_name)
self.stdout.write("_resolve_executable:")
self.stdout.write(f"{result}")
result = self._resolve_executable_updated(executable_name)
self.stdout.write("_resolve_executable_updated:")
self.stdout.write(f"{result}")
self.stdout.write(f"{self.help} - Complete") On my Windows server, the return value is different:
I am starting Dramatiq using a Windows service ( Sorry... I am not being much help here, but thought I would share. |
The
_resolve_executable
method indjango_dramatiq/management/commands/rundramatiq.py
will findvenv\Scripts\dramatiq
, but on Windows it needs to findvenv\Scripts\dramatiq.exe
Can we update the code in: 4c70775
The text was updated successfully, but these errors were encountered: