Tagged Questions
0
votes
1answer
19 views
Python subprocess stderr redirection, redirect warnings, still raise on control flow stoppers?
I did basic due diligence and couldn't find a good answer to this anywhere.
I want to call subprocess.Popen in a way that they will still raise a Python exception when control flow is interrupted, ...
1
vote
1answer
22 views
Python multiprocessing and handling exceptions in workers
I use python multiprocessing library for an algorithm in which I have many workers processing certain data and returning result to the parent process. I use multiprocessing.Queue for passing jobs to ...
1
vote
3answers
52 views
Python: variable “tricking” try-exception, but works for if statement
I know the title seems crazy, but it is true. Here is my predicament. First, I am still a beginner at Python so please be considerate. I am trying to test if a variable exists. Now the variable ...
3
votes
2answers
62 views
Python: Try/Except around whole module
I have a python module containing functions and a few classes. This module is basically used as a tool-set by several of my co-workers.
I want to set-up a sort of bug reporting system where anytime ...
0
votes
1answer
18 views
Exception handling in Python and Praw
I am having trouble with the following code:
import praw
import argparse
# argument handling was here
def main():
r = praw.Reddit(user_agent='Python Reddit Image Grabber v0.1')
for i in ...
1
vote
3answers
35 views
Generating random string of size 100 or more in python
When I am trying to generate random string of size 100 or more, it gives me exception...
msg="".join(random.sample(string.letters+string.digits,random.randint(5,100)))
Exception:
Traceback (most ...
0
votes
2answers
16 views
Customizing exceptions in python? writing logs in custom exception class?
I am customizing exceptions in my python code. I have inherited exception class in to other and now defining some custom errors as classes derived from my custom exception class like this:
class ...
0
votes
0answers
16 views
hadoop streaming job failed python
im trying to run simple word count with hadoop mapreduce with python. Im getting the following exception
java.lang.RuntimeException: PipeMapRed.waitOutputThreads(): subprocess failed with code ...
1
vote
1answer
22 views
Setting an exit code for a custom exception in python
I'm using custom exceptions to differ my exceptions from Python's default exceptions.
Is there a way to define a custom exit code when I raise the exception?
class MyException(Exception):
pass
...
0
votes
0answers
16 views
celerybeat raise exception “can't pickle module object” when putting both celery and celerybeat config in the same file?
I put celery/celerybeat config in the same settings.py:
from celery.schedules import crontab
from datetime import timedelta
CELERY_IMPORTS = ('some module',)
BROKER_URL = "****"
...
0
votes
1answer
48 views
Django: how to log exceptions from management commands?
I don't receive mails from errors happened in commands.
python deebate\manage.py test_logging_errors --settings=deebate.settings.local --traceback
the command:
# -*- coding: utf-8 -*-
from ...
3
votes
2answers
72 views
Ignore exceptions in a `for` statement
I am enumerating characters of a large character set like this (take GB2312 as an example, but much large in practice)
def get_gb2312_characters():
higher_range = range(0xb0, 0xf7 + 1)
...
2
votes
3answers
60 views
Run several commands until an exception DOESN'T occur? (Python)
Typically a try/except block can be used to run a bunch of statements until one of them causes an exception.
I want to do the opposite - run a set of statements where EACH of them will likely cause ...
1
vote
2answers
27 views
django - catch multiple exceptions
I have this view function:
def forum(request):
qs = Forum.objects.all()
try:
f = Forum.objects.filter().order_by('-id')[0] <------------problem
return ...
8
votes
2answers
105 views
Is there a difference between raising an exception and exception()
Defining a parameterless exception :
class myException(Exception):
pass
When raised, is there any difference between :
raise myException
and
raise myException()
When trying, I could find ...