On Feb 21, 12:53 am, Steven D'Aprano wrote:
> On Mon, 20 Feb 2012 12:37:22 -0800, Sheldon wrote:
> > Hi,
>
> > I'm trying to read a netCDF4 variable from a file (no problem) and then
> > scale it before writing over the original variable in the file.
>
&g
Hi,
I'm trying to read a netCDF4 variable from a file (no problem) and
then scale it before writing over the original variable in the file.
I'm using python 2.7 and the latest netCDF4 module. It's not that I
keep getting an error message but I want to do this without using for
loops and all the m
> Could I write my own if one does not exist?
Take a look at the getpass.py module. It's very short. The windows
version of the getpass function can be trivially modified to echo
something. The unix version is just as short but a bit more
complicated.
def win_getpass(prompt='Password: ', stream=N
Is there any way to make urllib2 handle NTLM authentication?
Sheldon Neuberger
--
http://mail.python.org/mailman/listinfo/python-list
If you're just writing Python code then it will run unmodified on his
Windows machine.
Are you planning on using other languages too?
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf
Of Levi Campbell
Sent: Friday, July 18, 2008 4:27 PM
To: python-list@python.
get an HTTP 401
exception. Any help would be much appreciated.
Code and traceback follows.
Regards,
Sheldon Neuberger
--
cj = cookielib.LWPCookieJar()
cookie_handler = urllib2.HTTPCookieProcessor(cj)
passmgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
passmgr.add_password
Martin v. Löwis skrev:
> Sheldon schrieb:
> > Can anyone tell me what this error mean:
> > #0 0x4008376e in PyType_IsSubtype () from /usr/lib/libpython2.3.so.1.0
>
> It's not an error. It is just a frame from the backtrace.
>
> To understand the crash better, o
d for
/usr/lib/python2.3/site-packages/Numeric/ranlib.so
Symbols already loaded for
/usr/lib/python2.3/site-packages/Numeric/lapack_lite.so
Symbols already loaded for /usr/lib/python2.3/lib-dynload/time.so
Symbols already loaded for
/data/proj_ns1/safworks/sheldon/MSG_PPS_COMP/c_codes/msgppsarea.
Jack Diederich skrev:
> On Wed, Jan 03, 2007 at 01:16:38PM -0800, Sheldon wrote:
> > I have a function that creates python objects out of C arrays and
> > returns them to Python. Below is a working example that I later want to
> > expand to return 12 arrays back to Python
a,i,op) !=0) {
fprintf(stderr,"Error in creating python va object\n");
exit(EXIT_FAILURE);
}
Py_DECREF(op);
op = 0;
return Py_BuildValue("N",Rva);
}
Results in Python:
, , , , , , , ,
, , ,
Any help is appreciated!
/Sheldon
--
http://mail.pyth
Klaas skrev:
> Sheldon wrote:
> > The code below is a rookie attempt to copy a python list of strings to
> > a string array in C. It works to some extent but results in memory
> > problems when trying to free the C string array. Does anyone know how
> > to do this prop
Nick Craig-Wood skrev:
> Sheldon <[EMAIL PROTECTED]> wrote:
> > Man. You are good. This is most insight I have had from anyone.
>
> :-)
>
> > I did initialize the arrays with PyObjects and today, after hours of
> > debugging and now with your insight, I t
Duncan Booth skrev:
> "Sheldon" <[EMAIL PROTECTED]> wrote:
>
> > I am new to this and copied this code from a colleague. So, it
> > corrupts the pointer. How do I do this properly?
> >
> Here is at least part of your problem:
>
> msgop = PyLi
Hi,
The code below is a rookie attempt to copy a python list of strings to
a string array in C. It works to some extent but results in memory
problems when trying to free the C string array. Does anyone know how
to do this properly?
***
/*Re
Nick Craig-Wood skrev:
> Sheldon <[EMAIL PROTECTED]> wrote:
> > Sheldon skrev:
> > > Wonderful! Now I know how to used gdb with python.
>
> Good!
>
> > > The are results area posted below. Since I am new at this I could
> > > used some
Nick Craig-Wood skrev:
> Sheldon <[EMAIL PROTECTED]> wrote:
> > gdb msgppscomp.py core.3203
>
> Run
>
> gdb python
>
> Then type
>
> run msgppscomp.py
>
> at the gdb prompt.
>
> When it crashes, type "bt" for a back trace. This
Nick Craig-Wood skrev:
> Sheldon <[EMAIL PROTECTED]> wrote:
> > gdb msgppscomp.py core.3203
>
> Run
>
> gdb python
>
> Then type
>
> run msgppscomp.py
>
> at the gdb prompt.
>
> When it crashes, type "bt" for a back trace. This
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as
"i586-mandrake-linux-gnu"..."/data/proj_ns1/safworks/sheldon/msgppscomp.py":
not in executable format: File fo
if(array == NULL) { // Memory for the Col
fprintf(stderr, "Failed to allocate memory\n");
exit(EXIT_FAILURE);
}
}
return array;
}
static
void MemoryFreeStr(int Col, char*** array) {
int i;
for (i = 0; i < 15; i++) {
free((*array)[i]);
}
free(*array);
}
Fredrik Lundh wrote:
> Sheldon wrote:
>
> > I am very new at this C extensions in Python so my term wrapper was
> > probably a misnomer. Perhaps glue is better or the interface that
> > allows the exchange of data between Python and C.
> > Yes, I am using py
Fredrik Lundh wrote:
> Sheldon wrote:
>
> > I am very new at this C extensions in Python so my term wrapper was
> > probably a misnomer. Perhaps glue is better or the interface that
> > allows the exchange of data between Python and C.
> > Yes, I am using py
Marc 'BlackJack' Rintsch wrote:
> In <[EMAIL PROTECTED]>, Sheldon wrote:
>
> > Now I am wondering if the problem is in Python and the wrapper? Does
> > anybody have any idea or experience with this? I am running on
> > Mandrake10 using python 2.3. I
person.
thanks in advance,
/Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
Gabriel Genellina skrev:
> At Tuesday 7/11/2006 17:27, Sheldon wrote:
>
> >Here is the file/module name: _msgpps_functions.c
> >Here is the initfunction:
> >
> >PyMODINIT_FUNC init_msgpps_functions(void) {
> > PyObject* m;
> > m=Py_InitModule(&q
module to do some number crunching. Now I just need to
"connect" it to my python program. Should the initmsgpps_functions() be
the only function in the file? Then how do I "connect" my C module to
my Python program?
/Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
Robert Kern skrev:
> Sheldon wrote:
>
> > This function is there and is called init_mymodule() but I have other
> > functions that are not static.
>
> Is the module's name "_mymodule"? Or is it "mymodule"?
>
> --
> Robert Kern
>
&
Farshid Lashkari skrev:
> Sheldon wrote:
> > Can anyone give me some idea as to what this error means?
> >
> > "ImportError: dynamic module does not define init function "
> >
> > I am new at this and there is still a lot to learn.
> >
&g
Hi,
Can anyone give me some idea as to what this error means?
"ImportError: dynamic module does not define init function "
I am new at this and there is still a lot to learn.
Any help is appreciated,
/Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
MRAB wrote:
> Sheldon wrote:
> > MRAB wrote:
> > > Sheldon wrote:
> > > > Hi.
> > > >
> > > > Does anyone know if one can resume a python script at the error point
> > > > after the error is corrected?
> > > > I ha
MRAB wrote:
> Sheldon wrote:
> > Hi.
> >
> > Does anyone know if one can resume a python script at the error point
> > after the error is corrected?
> > I have a large program that take forever if I have to restart from
> > scratch everytime. The error w
would like to create an exception that saves all the
current variables when there is an error. I think pickle is the answer
but I never got it to work. My program is very large and it is being
modified often.
Any advice on how to save the variables.
/Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
recalculated again.
Sincerely,
Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
Does anyone know if it is possible to resume the execution of a program
after it stops at an error in the code and the error was corrected?
Sincerely,
Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
I am new to unicode so please bear with my stupidity.
I am doing the following in a Python IDE called Wing with Python 23.
>>> s = "äöü"
>>> print s
äöü
>>> print s
äöü
>>> s
'\xc3\xa4\xc3\xb6\xc3\xbc'
>>> s.decode('utf-8')
u'\xe4\xf6\xfc'
>>> u = s.decode('utf-8')
>>> u
u'\xe4\xf6\xfc'
>>>
1 does it
horizontally. But the results does not reflect this.
What am I missing here?
I am using Numeric.
Any help is appreciated,
Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
Robert Kern skrev:
> Sheldon wrote:
> > Thanks again for showing me this. I have been trying to read up on
> > reduce() as I have never used it before. I would like to know what it
> > does. So far my search has found nothing that I can grasp. The
> > reference lib
Robert Kern wrote:
> Sheldon wrote:
> > Hi,
> >
> > I am trying to build a large array using concatenate function in
> > python.
> > So as I loop over the number of arrays, of which there are 12 (4 down
> > and 3 across), I create 3 long arrays by concat
Robert Kern skrev:
> Sheldon wrote:
> > Hi,
> >
> > I am trying to build a large array using concatenate function in
> > python.
> > So as I loop over the number of arrays, of which there are 12 (4 down
> > and 3 across), I create 3 long arrays by concat
Sheldon skrev:
> Hi,
>
> I am trying to build a large array using concatenate function in
> python.
> So as I loop over the number of arrays, of which there are 12 (4 down
> and 3 across), I create 3 long arrays by concatenating them at the
> bottom and then concatenat
ck
it in the python program and they are correct at the end but the
max(max(ppslon)) values is incorrect. Does anyone knows why this is
so?
If I was doing something wrong then Matlab would not have returned
correct values.
Any help is appreciated!
/Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
Scott David Daniels skrev:
> Sheldon wrote:
> > Hi,
> >
> > I have a series of classes that are all within the same file. Each is
> > called at different times by the main script. Now I have discovered
> > that I need several variables returned to the main script
Simon Forman skrev:
> Sheldon wrote:
> > Hi,
> >
> > I have a series of classes that are all within the same file. Each is
> > called at different times by the main script. Now I have discovered
> > that I need several variables returned to the main script. Si
that will be needed later instead of
passing them back and forth.
After trying this it did work! My question is why? Another way to solve
this problem is to make the variable I need global in the class that
they are created. Does anyone have a better way in mind?
Sincerely,
Sheldon
--
http://mail.py
Carl Banks wrote:
> Sheldon wrote:
> > average(compress(ravel(equal(wk,z)),ravel(sattmp)),axis=None)
> > This is much more compact and elegant. Thanks for pointing this out.
> > I don't know why average() returned a divide by zero error and to avoid
> > this I inse
Carl Banks wrote:
> Sheldon wrote:
> >Carl Banks wrote:
> >> I'm not sufficiently sure this isn't a homework problem, so here's a
> >> partial answer.
> [snip]
> >
> > My days as a student is over for the most part. I am learning python on
e where I going wrong. I am not
using the original arrays, only the copies and when a new z is chosen
then these are recreated.
Care to help out with this?
/Sheldon
Carl Banks wrote:
> Sheldon wrote:
> > Hi,
> >
> > I have the following loop that I think can be written to run f
the sum of the
values
count += 1 # count the occurrences
tmp_array[0,index] = round(mbias/count,1) # store the mean
tmp_array[1,index] = z
index += 1
Any help would be greatly appreciated!
Sincerely,
Sheldon
--
http://mail.python.org
27;t understand this part:
>>> print x
[10 1 30 3 50]
>>> putmask(x, [1,0,1,0,1], [-1,-2])
>>> print x
[-1 1 -1 3 -1]
Can you explain why the -2 didn't factor in?
/Sheldon
Sheldon wrote:
> Hi Alex,
>
> I will code this in a little while and get back to
into it when I get back to work tomorrow.
Bye for now,
Sheldon
Alex Martelli wrote:
> Sheldon <[EMAIL PROTECTED]> wrote:
>
> > Alex,
> >
> > I am using Numeric and have created 3 arrays: zero((1215,1215),Float)
> > Two arrays are compared and one is used to hold
these arrays at the same time. I cannot install Numpy due to my
working conditions. Sorry I should have made it clear that is was
Numeric I was working with.
/Sheldon
Alex Martelli wrote:
> Sheldon <[EMAIL PROTECTED]> wrote:
>
> > Hi Gary,
> >
> > I am really trying
Hi Gary,
I am really trying to cut the time down as I have 600+ arrays with
dimensions (1215,1215) to compare and I do a lot more things with the
arrays. If I understand you correctly, there is no way around a for
loop?
/Sheldon
Gary Herron wrote:
> Sheldon wrote:
> > Hi,
> >
this
without using for loops?
Sincerely,
Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
stead.
/Sheldon
Robert Kern skrev:
> Sheldon wrote:
> > Hi,
> >
> > I have a written a script that will check to see if the divisor is zero
> > before executing but python will not allow this:
> >
> > if statistic_array[0:4] > 0.0:
> > statistic_a
Thanks for the tips!
I am going to look into this some more.
/Sheldon
Simon Forman skrev:
> Sheldon wrote:
> > Hi,
> >
> > I have a written a script that will check to see if the divisor is zero
> > before executing but python will not allow this:
> >
&
hon is complaining:
"statistic_array[0,0:4] =
int(multiply(divide(statistic_array[0,0:4],statistic_array[0,4]),1.0))/100.0
OverflowError: math range error"
and how do I get around this problem? This stupid because there is a if
statement preventing this "dividing by zero&quo
Thanks Diez,
It will take a little while for this one to sink in but it gets the job
done now and will for future cases.
/Sheldon
Diez B. Roggisch skrev:
> >> print [i for i, _ in enumerate((None for x, y in zip(a, b) where x ==
> >> y))]
> >>
> >> ins
Thanks Diez,
It will take a little while for this one to sink in but it gets the job
done now and will for future cases.
/Sheldon
Diez B. Roggisch skrev:
> >> print [i for i, _ in enumerate((None for x, y in zip(a, b) where x ==
> >> y))]
> >>
> >> ins
enumerate((None for x, y in zip(a, b) where x == y))]
>
> instead.
>
> Diez
Hi Diez,
I wish I say that I understood what you wrote here but I can't.
Do you mind explaining a little more?
/sheldon
--
http://mail.python.org/mailman/listinfo/python-list
;> Numeric.logical_and(a==6,b==6)
0
>>> Numeric.where(a==b,1,0)
0
>>> Numeric.where(a==6 and b==6,1,0)
0
The where() statement is also worhtless here. Does anyone have any
suggestion on how to do this?
Thanks in advance,
Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
Marc 'BlackJack' Rintsch skrev:
> In <[EMAIL PROTECTED]>, Sheldon wrote:
>
> > I am using a HLHDF C wrapper to extract data from HDF (version 5)
> > files.
> > I can view the contents with IDL, for example, and read the attributes
> > in the HDF fil
which is called "baseline" but when python reads it, it returns
"baselin" instead.
Does anyone have any idea why this is happening?
Sincerely,
Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
Duncan Booth skrev:
> Sheldon wrote:
>
> > Good day,
> >
> > I would like to know if there is a way to print all the variables set
> > in a python program with having to write
> > "print variable" on all?
> >
> Not all the variables in a p
Good day,
I would like to know if there is a way to print all the variables set
in a python program with having to write
"print variable" on all?
sincerely,
Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
Thanks!
Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
27;) # file-like object
target = host.file('newdir/index.html', 'w') # file-like object
host.copyfileobj(source, target) # similar to shutil.copyfileobj
Any help would be greatly appreciated!
Sincerely,
Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I am interesseted on reading some GRIB files using python and then
converting the fields to gif images.
Does anyone know if this is possible or have a program that does this?
/Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
Thanks,
I later discovered that it was a big edian binary as well.
Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
e?
Thanks,
Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
Thanks Travis,
I don't have the new NumPy yet but this tofile() method should work
fine.
/Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
ith
open("filename", 'wb'), I lose the decimals that are vital. The input
data is float with about 4 decimal places.
Does anyone have any ideas of how to improve this by writing the 2D
array in binary form?
Thanks,
Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
Sorry Mike, after seeing so many "experts" beat up others for not being
as "smart" as they are, I intrepreted your words incorrectly - my
apologies. I am not in the least bit against impproving my programming.
I liked what you did and thanks for the pointers.
Sheldon
--
ht
was executed without error or -1 for
an error. We have not tried to catch the error from the C-code. Sorry.
Perhaps some else knows how.
cheers,
Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
So Mike if you can do better then do it then! There are many ways do
solve a problem, perhaps you have not learned that yet. At first this
guy didn't know what to do, so he had to begin somewhere. Now you can
take him much further, I am sure but the journey might not be so
pleasant. Your attitude r
error handling using the function RAISE:
try:
Call C
except:
raise my_error.
A catch-all error is RuntimeError; try this first.
try:
call C
except RuntimeError, r:
print r
You can read up on it here:
http://docs.python.org/api/standardExceptions.html
Cheers,
Sheldon
--
http://mail.pytho
a much easier way so lets hope that this is so.
I hope this was more clear and helpful this time around.
Cheers
Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
eve
that it should work.
Sincerely,
Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
Hi Fredrik,
I am using python 2.3.3
I am checking now the previous lines for errors.
Thanks,
Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
Hi Rod,
You were right. The error was on the previous line. I will remember
that.
Thanks for your help!
Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
Hi Rod,
This sounds very interesting. I am checking the previous lines and will
get back to you.
Thanks,
Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
something else. Can anyone point me in the right direction? What
triggers such erroneous errors in Python?
Sincerely,
Sheldon
--
http://mail.python.org/mailman/listinfo/python-list
80 matches
Mail list logo