Re: Create a website from API available

2020-12-05 Thread Kasper Laudrup

Hi Man,

On 05/12/2020 00.14, man nguyen wrote:
I am learning django and I want to ask if django will assist me in 
creating a website using the available api and I want to know how to do 
it?  api docs i have :

https://developer.cisco.com/meraki/api-v1/#!get-device
  please tell me how to do it. tks



I would simply contact the relevant API endpoints from the relevant 
views. Should be simple enough. Maybe I'm missing something?


Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/36b29847-f111-565a-3024-2581495a1c5a%40stacktrace.dk.


Re: models design for student result system

2020-12-05 Thread Kasper Laudrup

Hi Dexterr,

On 05/12/2020 07.40, Dexterr Jay wrote:

image.png
i need help with design of the above models for my student result system 
project




What kind of help do you need? What have you done so far?

Try to be a bit more specific.

Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b836755d-b81f-2339-c128-c0b746e2d157%40stacktrace.dk.


Re: controlling stdout

2020-12-05 Thread Tom Sgouros
Matlab is the native language of the group for which I am building this
interface. It is for access to ocean sensor data, and it's being done this
way so the scientists whose sensors they are can use a significant body of
legacy code in their analyses. (Though I was planning to sneak in an option
to use python scripts because that's what I prefer.)

But the fact remains that I have no trouble capturing stdout when I run
this python on the command line and it doesn't work when I run it as part
of a Django views.py and I don't where to begin trying to understand why
not.

 -Tom

On Fri, Dec 4, 2020 at 3:33 PM Kris A. Stern  wrote:

> Why not try something Python based instead which is also free. What kind
> of functionality are you looking for? Are you planning to plot, if so you
> could try numpy, scipy, and matplotlib.
>
> On Sat, 5 Dec 2020 at 02:02, Tom Sgouros  wrote:
>
>> Anybody have any random thoughts about this? I have run out of ideas to
>> test.
>>
>> Thank you,
>>
>>  -Tom
>>
>> On Wed, Dec 2, 2020 at 10:32 PM Tom Sgouros  wrote:
>>
>>> Hello all:
>>>
>>> I have a Django application that dispatches processing to a matlab
>>> script using exec. How can I capture the stdout and stderr of the script's
>>> execution?
>>>
>>> Outside of Django, this works for a dumb matlab script called tt that
>>> just prints a message:
>>>
>>> >>> import matlab.engine, StringIO
>>> >>> eng = matlab.engine.start_matlab()
>>> >>> out = StringIO.StringIO()
>>> >>> err = StringIO.StringIO()
>>> >>> exec('eng.tt(25, stdout=out, stderr=err)')
>>> >>> out.getvalue()
>>> "This is a disp command.\n\nret =\n\n '25\n\n"
>>>
>>> Inside a Django method, the exec seems to function properly, but the out
>>> and err variables remain empty. Where's my output? Did the logging system
>>> snatch it? I assume I'm missing something obvious here but any pointers
>>> would be welcome.
>>>
>>> Thank you,
>>>
>>>  -Tom
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/35b264b3-f793-4131-a6e4-700e51aebbfan%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAFUviqs6XXxfzOqQ4uCnVBEo2cN%2BbMMPHPEO-wtbxPVa94PtHw%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMxZ8Sm7avV%3Df664b%3D8hYQWgAUwvpL%2BLVZV%3D31Hy21B2xeSDtA%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFUviqvvOZUorVSmT1DSe_GO53_UEntvshiEzLxtUCAg%2BRFcPw%40mail.gmail.com.


Re: controlling stdout

2020-12-05 Thread Shaheed Haque
I would hazard a guess that Django has already redirected stderr and or
stdout before your code gets to run.

I recommend that you stop your code in the debugger just *before* you try
your redirection and look at the state of sys.stderr and sys.stdout. Also,
I'm not sure if you are aware of the dunder versions of these (see
https://docs.python.org/3/library/sys.html)? Comparing sys.stdout with
sys.__stdout__ might reveal interesting results for example.

Once you know what Django has already done, I expect you will be able to
progress.

On Sat, 5 Dec 2020, 13:18 Tom Sgouros,  wrote:

> Matlab is the native language of the group for which I am building this
> interface. It is for access to ocean sensor data, and it's being done this
> way so the scientists whose sensors they are can use a significant body of
> legacy code in their analyses. (Though I was planning to sneak in an option
> to use python scripts because that's what I prefer.)
>
> But the fact remains that I have no trouble capturing stdout when I run
> this python on the command line and it doesn't work when I run it as part
> of a Django views.py and I don't where to begin trying to understand why
> not.
>
>  -Tom
>
> On Fri, Dec 4, 2020 at 3:33 PM Kris A. Stern  wrote:
>
>> Why not try something Python based instead which is also free. What kind
>> of functionality are you looking for? Are you planning to plot, if so you
>> could try numpy, scipy, and matplotlib.
>>
>> On Sat, 5 Dec 2020 at 02:02, Tom Sgouros  wrote:
>>
>>> Anybody have any random thoughts about this? I have run out of ideas to
>>> test.
>>>
>>> Thank you,
>>>
>>>  -Tom
>>>
>>> On Wed, Dec 2, 2020 at 10:32 PM Tom Sgouros  wrote:
>>>
 Hello all:

 I have a Django application that dispatches processing to a matlab
 script using exec. How can I capture the stdout and stderr of the script's
 execution?

 Outside of Django, this works for a dumb matlab script called tt that
 just prints a message:

 >>> import matlab.engine, StringIO
 >>> eng = matlab.engine.start_matlab()
 >>> out = StringIO.StringIO()
 >>> err = StringIO.StringIO()
 >>> exec('eng.tt(25, stdout=out, stderr=err)')
 >>> out.getvalue()
 "This is a disp command.\n\nret =\n\n '25\n\n"

 Inside a Django method, the exec seems to function properly, but the
 out and err variables remain empty. Where's my output? Did the logging
 system snatch it? I assume I'm missing something obvious here but any
 pointers would be welcome.

 Thank you,

  -Tom


 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/35b264b3-f793-4131-a6e4-700e51aebbfan%40googlegroups.com
 
 .

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAFUviqs6XXxfzOqQ4uCnVBEo2cN%2BbMMPHPEO-wtbxPVa94PtHw%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAMxZ8Sm7avV%3Df664b%3D8hYQWgAUwvpL%2BLVZV%3D31Hy21B2xeSDtA%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFUviqvvOZUorVSmT1DSe_GO53_UEntvshiEzLxtUCAg%2BRFcPw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this

Looking for a new project

2020-12-05 Thread Dishita Bhasin
Warm Greetings everyone, myself Dishita Bhasin. I would love to contribute 
to this wonderful organization. Can someone please help me out on how to 
get started and suggest some projects? I have knowledge of C++ and Python.

Thanks 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a95f842a-77bd-46be-ba78-5933abbfa1d6n%40googlegroups.com.


Re: models design for student result system

2020-12-05 Thread boyuanl...@gmail.com
 You can create three models:1. The student's model, contains student's 
information,2. The Courses' model, contains all the courses information,3. The 
student_course_grade model, contains all student's grade information
On Friday, December 4, 2020, 10:42:37 PM PST, Dexterr Jay 
 wrote:  
 
 
i need help with design of the above models for my student result system 
project 


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAC32Mkg%3DQu_Trk0C4idfPdu14uB88jadLPNAO5qAMh-0BvMyAA%40mail.gmail.com.
  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1585834879.2999461.1607150694140%40mail.yahoo.com.


Re: Create a website from API available

2020-12-05 Thread Z Z
Hello I am ZhengZhen
I have rich experience for building REST api with django . please contact
to me .

On Fri, Dec 4, 2020 at 6:28 PM man nguyen  wrote:

> I am learning django and I want to ask if django will assist me in
> creating a website using the available api and I want to know how to do
> it?  api docs i have :
> https://developer.cisco.com/meraki/api-v1/#!get-device
>  please tell me how to do it. tks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9a95a96e-4880-476d-a675-f2c977d33a27n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADF21vCP-B%3DJwpU%2BGeb7aw5n6PHpCOXSuq4sjqd5_SOtUgkzHQ%40mail.gmail.com.


Re: Looking for a new project

2020-12-05 Thread 1 9 5 9 0 Aman kumar
Start by creating portfolio...

On Sat, 5 Dec 2020, 22:00 Dishita Bhasin,  wrote:

> Warm Greetings everyone, myself Dishita Bhasin. I would love to contribute
> to this wonderful organization. Can someone please help me out on how to
> get started and suggest some projects? I have knowledge of C++ and Python.
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a95f842a-77bd-46be-ba78-5933abbfa1d6n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAF77ry027r8ou97v8fm_kf8chFSsH%3DLBSXZrX9XR4_dV83Jy_A%40mail.gmail.com.


Re: How to Get Video to Play

2020-12-05 Thread Ryan Nowakowski
tl;dr check the encoding of your video

Disclosure: I'm no video expert.

I had a similar issue years ago. Back when the transition from flash video to 
HTML5 was occurring. Your issue could have something to do with how the video 
is encoded. One reason that services like YouTube and Vimeo are useful is that 
they do the transcoding of the uploaded video. That way when users go to watch 
the video it plays correctly in their browser or device of choice.

I'm assuming you're using HTML5 to play back a video. I would check the 
encoding of your video and transcode it if the current encoding is not 
compatible with the codecs supported by your browser.



On December 3, 2020 6:56:52 PM CST, Nick Sokol  wrote:
>Hi All,
>
>I am trying to play uploaded video on a django web app but I keep
>getting a white screen and audio. 
>
>Does anyone know how to fix this? Also, is this a django issue or html
>issue? 
>
>Thank you! 
>
>-- 
>You received this message because you are subscribed to the Google
>Groups "Django users" group.
>To unsubscribe from this group and stop receiving emails from it, send
>an email to django-users+unsubscr...@googlegroups.com.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/django-users/3EF43401-A003-4250-AFD0-4A6867D93196%40gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/01EC1FAA-8E42-4794-9584-E037552F22CE%40fattuba.com.


Re: Looking for a new project

2020-12-05 Thread Omkar Parab
Welcome to the django community! 🎉

Here's the playlist for Django 3.0
https://www.youtube.com/playlist?list=PL-51WBLyFTg2vW-_6XBoUpE7vpmoR3ztO

On Sat, Dec 5, 2020, 9:59 PM Dishita Bhasin  wrote:

> Warm Greetings everyone, myself Dishita Bhasin. I would love to contribute
> to this wonderful organization. Can someone please help me out on how to
> get started and suggest some projects? I have knowledge of C++ and Python.
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a95f842a-77bd-46be-ba78-5933abbfa1d6n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJY8mfxa6OsUy3VibWT387GBzHE7%2BXiBCu%3D5OvSN4_1cG6Gv4w%40mail.gmail.com.


Re: Looking for a new project

2020-12-05 Thread sakshi jain
https://youtu.be/XUA0iZdW7D4

On Sat, Dec 5, 2020, 22:38 Omkar Parab  wrote:

> Welcome to the django community! 🎉
>
> Here's the playlist for Django 3.0
> https://www.youtube.com/playlist?list=PL-51WBLyFTg2vW-_6XBoUpE7vpmoR3ztO
>
> On Sat, Dec 5, 2020, 9:59 PM Dishita Bhasin 
> wrote:
>
>> Warm Greetings everyone, myself Dishita Bhasin. I would love to
>> contribute to this wonderful organization. Can someone please help me out
>> on how to get started and suggest some projects? I have knowledge of C++
>> and Python.
>>
>> Thanks
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/a95f842a-77bd-46be-ba78-5933abbfa1d6n%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJY8mfxa6OsUy3VibWT387GBzHE7%2BXiBCu%3D5OvSN4_1cG6Gv4w%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJhs3iOuE5Cs2MOtVsnzFEP-X6TzLuq3AJeL2dBBmpVn_E7iMw%40mail.gmail.com.


Re: Django don't save a form using Floppyforms on a foreign key field

2020-12-05 Thread Walter Randazzo
Hi dudes,
Here is an update on this:

Workarround: I removed floppyforms on my Project and use Select2 instead
because it supports searches on foreignkey field and also create an
instance with a form easily.

Template


$(document).ready(function() {
  $('#id_medicamento').select2();
});

forms.py

class StockmovForm(forms.ModelForm):class Meta:model = Stockmov

fields =  ['medicamento', 'motivo', 'Cantidad' ]
widgets = {'medicamento': forms.Select(attrs={'class':'form-control',
'placeholder':'Medicamento'}),'motivo':
forms.TextInput(attrs={'class':'form-control',
'placeholder':'Motivo'}),'Cantidad':
forms.NumberInput(attrs={'class':'form-control',
'placeholder':'Cantidad'}),
}
labels = {
'medicamento':'Medicamento', 'motivo':'Motivo del Movimiento',
'Cantidad':'Cantidad del Movimiento',
}

cya!



El mié, 2 dic 2020 a las 18:55, Walter Randazzo ()
escribió:

> Hi guys,
>
> I have a field called medicamento in my model that is a foreign key and I
> want all the values in that field to be displayed in a searcheable dropdown
> in my form. I was able to do that but when I try to save, it says "Select a
> valid choice. That choice is not one of the available choices."
>
> Hope u can help dudes!
>
> Thanks in advance
>
> The Code:
>
> *models.py*
>
> class Stockmov(models.Model):
> numero = models.AutoField(primary_key=True)
> created= models.DateTimeField(auto_now_add=True,verbose_name="Fecha de
> Movimiento")
> author =
> models.ForeignKey(User,verbose_name="autor",on_delete=models.PROTECT,
> null=True, blank=True)
> medicamento= models.ForeignKey(Medicamento,on_delete=models.CASCADE)
> motivo= models.CharField(max_length=200)
> Cantidad = models.IntegerField()
>
> *forms.py*
>
> class StockmovForm(forms.ModelForm):
> class Meta:
> model = Stockmov
>
> fields =  ['medicamento', 'motivo', 'Cantidad' ]
> widgets = {
> #'medicamento': forms.Select(attrs={'class':'form-control',
> 'placeholder':'Medicamento'}),
> 'medicamento':
> forms.widgets.TextInput(attrs={'class':'form-control',
> 'placeholder':'Medicamento'},datalist=Medicamento.objects.all()),
> 'motivo': forms.TextInput(attrs={'class':'form-control',
> 'placeholder':'Motivo'}),
> 'Cantidad': forms.NumberInput(attrs={'class':'form-control',
> 'placeholder':'Cantidad'}),
> }
> labels = {
> 'medicamento':'Medicamento', 'motivo':'Motivo del Movimiento',
> 'Cantidad':'Cantidad del Movimiento',
> }
>
> *views.py*
>
> class StockmovCreate(CreateView):
> model = Stockmov
> form_class = StockmovForm
> success_url = reverse_lazy('stockmov:stockmov')
>
> def form_valid(self, form):
> form.instance.author = self.request.user
> print(self.request.user)
> return super(StockmovCreate, self).form_valid(form)
>
> *Template*
>
>   {% csrf_token %}
>{{ form.as_p }}`s`
> 
>   
> 
>   
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/69572c34-5ea6-425a-b0f4-b148438d6883n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAL7Dry4tpDjbOfCcpY6WLK0cpOEpZfJXgmvnH4QM3ywOuun4fg%40mail.gmail.com.


Re: controlling stdout

2020-12-05 Thread Tom Sgouros
Thank you. Now I guess I'll work on figuring out *where* it was redirected.

But the "dunder" version of sys.stdout is an excellent clue -- I did not
know about that, and bonus gratitude points for giving me a new word to use.

 -Tom

On Sat, Dec 5, 2020 at 9:06 AM Shaheed Haque  wrote:

> I would hazard a guess that Django has already redirected stderr and or
> stdout before your code gets to run.
>
> I recommend that you stop your code in the debugger just *before* you try
> your redirection and look at the state of sys.stderr and sys.stdout. Also,
> I'm not sure if you are aware of the dunder versions of these (see
> https://docs.python.org/3/library/sys.html)? Comparing sys.stdout with
> sys.__stdout__ might reveal interesting results for example.
>
> Once you know what Django has already done, I expect you will be able to
> progress.
>
> On Sat, 5 Dec 2020, 13:18 Tom Sgouros,  wrote:
>
>> Matlab is the native language of the group for which I am building this
>> interface. It is for access to ocean sensor data, and it's being done this
>> way so the scientists whose sensors they are can use a significant body of
>> legacy code in their analyses. (Though I was planning to sneak in an option
>> to use python scripts because that's what I prefer.)
>>
>> But the fact remains that I have no trouble capturing stdout when I run
>> this python on the command line and it doesn't work when I run it as part
>> of a Django views.py and I don't where to begin trying to understand why
>> not.
>>
>>  -Tom
>>
>> On Fri, Dec 4, 2020 at 3:33 PM Kris A. Stern 
>> wrote:
>>
>>> Why not try something Python based instead which is also free. What kind
>>> of functionality are you looking for? Are you planning to plot, if so you
>>> could try numpy, scipy, and matplotlib.
>>>
>>> On Sat, 5 Dec 2020 at 02:02, Tom Sgouros  wrote:
>>>
 Anybody have any random thoughts about this? I have run out of ideas to
 test.

 Thank you,

  -Tom

 On Wed, Dec 2, 2020 at 10:32 PM Tom Sgouros  wrote:

> Hello all:
>
> I have a Django application that dispatches processing to a matlab
> script using exec. How can I capture the stdout and stderr of the script's
> execution?
>
> Outside of Django, this works for a dumb matlab script called tt that
> just prints a message:
>
> >>> import matlab.engine, StringIO
> >>> eng = matlab.engine.start_matlab()
> >>> out = StringIO.StringIO()
> >>> err = StringIO.StringIO()
> >>> exec('eng.tt(25, stdout=out, stderr=err)')
> >>> out.getvalue()
> "This is a disp command.\n\nret =\n\n '25\n\n"
>
> Inside a Django method, the exec seems to function properly, but the
> out and err variables remain empty. Where's my output? Did the logging
> system snatch it? I assume I'm missing something obvious here but any
> pointers would be welcome.
>
> Thank you,
>
>  -Tom
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/35b264b3-f793-4131-a6e4-700e51aebbfan%40googlegroups.com
> 
> .
>
 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAFUviqs6XXxfzOqQ4uCnVBEo2cN%2BbMMPHPEO-wtbxPVa94PtHw%40mail.gmail.com
 
 .

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAMxZ8Sm7avV%3Df664b%3D8hYQWgAUwvpL%2BLVZV%3D31Hy21B2xeSDtA%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit

Re: controlling stdout

2020-12-05 Thread Shaheed Haque
On Sat, 5 Dec 2020, 21:57 Tom Sgouros,  wrote:

> Thank you. Now I guess I'll work on figuring out *where* it was redirected.
>

Sounds good.

But the "dunder" version of sys.stdout is an excellent clue -- I did not
> know about that, and bonus gratitude points for giving me a new word to use.
>

Lol. Good luck...


>  -Tom
>
> On Sat, Dec 5, 2020 at 9:06 AM Shaheed Haque 
> wrote:
>
>> I would hazard a guess that Django has already redirected stderr and or
>> stdout before your code gets to run.
>>
>> I recommend that you stop your code in the debugger just *before* you try
>> your redirection and look at the state of sys.stderr and sys.stdout. Also,
>> I'm not sure if you are aware of the dunder versions of these (see
>> https://docs.python.org/3/library/sys.html)? Comparing sys.stdout with
>> sys.__stdout__ might reveal interesting results for example.
>>
>> Once you know what Django has already done, I expect you will be able to
>> progress.
>>
>> On Sat, 5 Dec 2020, 13:18 Tom Sgouros,  wrote:
>>
>>> Matlab is the native language of the group for which I am building this
>>> interface. It is for access to ocean sensor data, and it's being done this
>>> way so the scientists whose sensors they are can use a significant body of
>>> legacy code in their analyses. (Though I was planning to sneak in an option
>>> to use python scripts because that's what I prefer.)
>>>
>>> But the fact remains that I have no trouble capturing stdout when I run
>>> this python on the command line and it doesn't work when I run it as part
>>> of a Django views.py and I don't where to begin trying to understand why
>>> not.
>>>
>>>  -Tom
>>>
>>> On Fri, Dec 4, 2020 at 3:33 PM Kris A. Stern 
>>> wrote:
>>>
 Why not try something Python based instead which is also free. What
 kind of functionality are you looking for? Are you planning to plot, if so
 you could try numpy, scipy, and matplotlib.

 On Sat, 5 Dec 2020 at 02:02, Tom Sgouros  wrote:

> Anybody have any random thoughts about this? I have run out of ideas
> to test.
>
> Thank you,
>
>  -Tom
>
> On Wed, Dec 2, 2020 at 10:32 PM Tom Sgouros 
> wrote:
>
>> Hello all:
>>
>> I have a Django application that dispatches processing to a matlab
>> script using exec. How can I capture the stdout and stderr of the 
>> script's
>> execution?
>>
>> Outside of Django, this works for a dumb matlab script called tt that
>> just prints a message:
>>
>> >>> import matlab.engine, StringIO
>> >>> eng = matlab.engine.start_matlab()
>> >>> out = StringIO.StringIO()
>> >>> err = StringIO.StringIO()
>> >>> exec('eng.tt(25, stdout=out, stderr=err)')
>> >>> out.getvalue()
>> "This is a disp command.\n\nret =\n\n '25\n\n"
>>
>> Inside a Django method, the exec seems to function properly, but the
>> out and err variables remain empty. Where's my output? Did the logging
>> system snatch it? I assume I'm missing something obvious here but any
>> pointers would be welcome.
>>
>> Thank you,
>>
>>  -Tom
>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/35b264b3-f793-4131-a6e4-700e51aebbfan%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFUviqs6XXxfzOqQ4uCnVBEo2cN%2BbMMPHPEO-wtbxPVa94PtHw%40mail.gmail.com
> 
> .
>
 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAMxZ8Sm7avV%3Df664b%3D8hYQWgAUwvpL%2BLVZV%3D31Hy21B2xeSDtA%40mail.gmail.com
 
 .

>>> --
>>> You received this message because you are subscribed to the