dest='new')
>
Here you've imported parser as an alias to the OptionParser class. You can
only use add_option() on an instance of that class. Try this:
from optparse import OptionParser
parser = OptionParser()
parser.add_option('-n','--new',dest='ne
ny way of rewriting this so I can still print the error message in
python2.5/2.4?
Thanks!
Jason
--
Jason M. Swails
Quantum Theory Project,
University of Florida
Ph.D. Candidate
352-392-4032
--
http://mail.python.org/mailman/listinfo/python-list
n2.6 and 2.7.
> > Is there any way of rewriting this so I can still print the error message
> in
> > python2.5/2.4?
> > <http://mail.python.org/mailman/listinfo/python-list>
>
Many Unix OSes (especially on supercomputers) have painfully out-of-date
system python versions, so
nstall directory location as part of the
install process, which is done sometimes as well. This is easily accessible
from python via
os.environ['HOME']
or
os.getenv('HOME')
All the best,
Jason
--
Jason M. Swails
Quantum Theory Project,
University of Florida
Ph.D. Candidate
e can't possibly keep an unchanging system of measurement.
Not to disagree with Steven, as these arguments are irrelevant in (almost
all) current scientific research; just to pose thoughts.
Food for thought,
Jason
--
http://mail.python.org/mailman/listinfo/python-list
It makes me nervous to just change the daemon status of the process like
that, especially when I don't know the reason the workers have
daemon=True to begin with. What is the reasoning behind that decision?
What issues do we need to worry about if we just set the daemon mode
flag like
On 3/18/11 3:29 PM, Ned Deily wrote:
In article<[email protected]>,
Jason Grout wrote:
The problem appears to be that multiprocessing sets its workers to have
the daemon flag set to True, which prevents workers from creating child
processes. If I uncomment the line ind
On 3/19/11 4:17 PM, John L. Stephens wrote:
On 3/18/2011 7:54 PM, Jason Grout wrote:
Right; thanks. Let me rephrase my questions:
1. Why is important that the multiprocessing Pool worker processors
have daemon=True (I think this is the same as asking: why is it
important that they be
#x27;d rather do
something like
opts.variable
than
opts.dictionary['variable']
Just my 2c. Thanks to JM for suggesting setattr, btw.
--Jason
--
http://mail.python.org/mailman/listinfo/python-list
I'm guessing you have something like
list1=['1.0', '2.3', '4.4', '5.5', ...], right?
You can do this:
for i in range(len(list1)):
list1[i] = float(list1[i])
There's almost certainly a 1-liner you can use, but this should work.
--Jason
On F
algorithm, without going into much technical details is,
> P0(x1,x2), P1(x1,x2)
>
> Now I am taking random.random() to generate both x1 and x2 and trying
> to multiply them, is it fine? Or should I take anything else?
>
>
I see no reason why you can't multiply them... I
y call that
function, but then I fill up my script with trys and excepts which hurts
readability (and makes the code uglier) and quashes tracebacks; neither of
which I want to do.
Any thoughts?
Thanks!
Jason
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, Apr 10, 2011 at 12:34 PM, Laszlo Nagy wrote:
> 2011.04.10. 21:25 keltezéssel, Jason Swails írta:
>
> Hello everyone,
>
> This may sound like a bit of a strange desire, but I want to change the
> way in which a python program quits if an exception is not caught. The
On Sun, Apr 10, 2011 at 4:49 PM, Jerry Hill wrote:
> On Sun, Apr 10, 2011 at 3:25 PM, Jason Swails
> wrote:
> >
> > Hello everyone,
> >
> > This may sound like a bit of a strange desire, but I want to change the
> way in which a python program quits if an except
;
This is only true if n < 5. Otherwise, the first returns None and the
second returns False.
>>> def foo(n):
... x = n < 5
... if x: return x
...
>>> def foo1(n):
... return n < 5
...
>>> foo(4)
True
>>> foo1(4)
True
>>> foo(6)
>>> foo1(6)
False
>>>
--Jason
--
http://mail.python.org/mailman/listinfo/python-list
quaEnvVar.html
Maybe if you prepend your Python 2.6 (MacPorts?) location to your PATH,
it'll find it.
--Jason
--
http://mail.python.org/mailman/listinfo/python-list
ave that much time for
self-entertainment, but that would be pretty awesome (terrible?).
--Jason
--
http://mail.python.org/mailman/listinfo/python-list
> import os
> def fib(n):
> if n == 1:
> return(n)
> else:
> return (fib(n-1)+fib(n-2))
>
> list=fib(20)
> print(list)
>
> The above function return the
> return (fib(n-1)+fib(n-2))
>
>
> RuntimeError: maximum recursion depth exceeded in comparison
> [36355 refs]
>
>
buted VCS is good at supporting that, but in practice I went
> back to my lightweight synchronization scripts and file storage
> again. With the API, I could have best of both worlds.
You should take a look at Bazaar. I found it fairly easy to use bzrlib
from my own Python scripts.
http:/
-- both connotatively and denotatively -- and to
argue against the claim that Python 2 and 3 are "completely
incompatible" it seems to me sufficient to provide a single non-trivial
counter-example, which Steven has already done.
Cheers,
Jason.
--
http://mail.python.org/mailman/listinfo/python-list
Hi everyone,
I want to use a metaclass to override how class instantiation works. I've
done something analogous to using the Singleton metaclass from the Python3
Cookbook example.
However, I want to provide a classmethod that allows for "normal" class
instantiation that prevents this metaclass fr
(I'm using python3)
@classmethod
def normal_constructor(cls, *args, **kwargs):
self = cls.__new__(cls)
self.__init__(*args, **kwargs)
return self
On Wed, Nov 1, 2017 at 6:51 PM, Stefan Ram wrote:
> Jason Maldonis writes:
> >I was looking for documentation for what exac
Ok no worries then! Thanks for the tips. I might wait until tomorrow then
until someone comes along who deals with metaclasses and alternate class
constructors.
In case you're curious, I'm doing two things that are relevant here, and
I'll link the python3 cookbook examples that are super useful (I
choice -- for the reasons I listed above -- but I
would like a more expert opinion (and I'd like to learn why :)).
Thanks!
Jason
On Thu, Nov 2, 2017 at 12:28 AM, Steve D'Aprano
wrote:
> On Thu, 2 Nov 2017 10:13 am, Jason Maldonis wrote:
>
> > Hi everyone,
> >
&
I was extending a `list` and am wondering why slicing lists will never
raise an IndexError, even if the `slice.stop` value if greater than the
list length.
Quick example:
my_list = [1, 2, 3]
my_list[:100] # does not raise an IndexError, but instead returns the full
list
Is there any background
>
> Have you ever used a language that does that?
I have.
> The String class in the C# language does that, and it's /really/ annoying.
> I have to add extra code to prevent such exceptions.
> In practice, I find that the way that Python does it is much nicer. (And
> Python isn't unique in this res
>Why would this simplify your code? What are you doing that would benefit
>from an IndexError here?
Without simplifying too much, I'm writing a wrapper around a REST API. I
want lazy-loading functionality for lists-of-things, so I am creating a
LazyList class.
This LazyList class will load items
>
> This is explained in the Python tutorial for strings
> https://docs.python.org/3/tutorial/introduction.html#strings, as a list
> is a sequence just like a string it will act in exactly the same way.
>
The only relevant bit I found in that link is: "However, out of range
slice indexes are hand
>
> >> This is explained in the Python tutorial for strings
> >> https://docs.python.org/3/tutorial/introduction.html#strings, as a list
> >> is a sequence just like a string it will act in exactly the same way.
> >>
> >
> > The only relevant bit I found in that link is: "However, out of range
> >
I'll try to summarize what I've learned with a few responses in hodge-podge
order and to no one in particular:
>That's a feature dude, not a bug.
Absolutely. I _do not_ think that how slicing works in python should be
changed, but I _do_ want to understand its design decisions because it will
mak
I was extending a `list` and am wondering why slicing lists will never raise an
IndexError, even if the `slice.stop` value if greater than the list length.
Quick example:
my_list = [1, 2, 3]
my_list[:100] # does not raise an IndexError, but instead returns the full
list
Is there any background
these libraries is doing something naughty?
Thanks!
Jason
--
Jason M. Swails
--
https://mail.python.org/mailman/listinfo/python-list
>
> import smtplib
> server = smtplib.SMTP('localhost')
> server.sendmail('[email protected]',
> """To: [email protected]
> From: [email protected]
>
> Beware the Ides of March.
> """)
> server.quit()
>
> when running this I get the following message. Please help:
>
> Traceback (most recent
> statistics.mode() currently raises an exception if there is more than one
> mode.
>
I am an infrequent user of this package and this function. My two cents:
* Leave the current behavior as-is.
* Continue to throw an exception for no data.
* Add an argument, named perhaps mutli=False, that if se
>
> I try to run an application with the latest version of python that is
> python 3.6.4 (32-bit) ., instead of running the application it only shows
> feel free to mail [email protected] if you continue to encounter
> issues,Please help me out thanks.
>
Hello, you might have more success if
>
> I want learn python for 4 weeks and have problems, installing Tkinter. If
> I installed 3.11.0 for my windows 8.1 from python.org and type
>
> >>> import _tkinter
> > Traceback (most recent call last):
> >File "", line 1, in
> > ImportError: DLL load failed while importing _tkinter
在 2023/4/15 2:33, angela vales 写道:
Hello All,
I found this small group in a google search, so not sure if it is still active
but giving it a try nonetheless.
I have recently created a tkinter app and need the ability to copy and paste
data from tksheet table into an Excel file. I do have a bu
I'm trying to reconcile two best practices which seem to conflict.
1) Use a _with_ clause when connecting to a database so the connection is
closed in case of premature exit.
class_name = 'oracle.jdbc.OracleDriver'
url = f"jdbc:oracle:thin:@//{host_name}:{port_number}/{database_name}"
with jdbc.c
>
>
> for path, dir, files in os.walk(myDestinationFolder):
> # for path, dir, files in os.walk(destfolder):
> print('The path is %s: ', path)
> print(files)
> os.chdir(mySourceFolder)
> if not os.path.isfile(myDestinationFolder + file):
> # if not os.path.isfile(destfolder + f
>
> I set listen(2) and expect to see "error" when more clients than "the
> maximum number of queued connections" trying to connect the server. But, no
> error!! Even 4 clients can run normally without problem.
>
> Am I misunderstanding the meaning of this argument?
>
https://docs.python.org/3/lib
I should state at the start that I have a solution to my problem. I am
writing to see if there is a better solution.
I have a program that runs via crontab every five minutes. It polls a
Box.com folder for files and, if any are found, it copies them locally and
performs a computation on them that
> Hey All,
>
> I have a set of bash and python scripts that all interact with a remote
> git repository.
>
This does not exactly answer your question, but whenever I have wanted to
interact with (popular) software via Python I have checked to see if
someone has already written that code for me.
h
>
>
> Hey All,
>
> I have a set of bash and python scripts that all interact with a remote
> git repository.
>
>
> https://gitpython.readthedocs.io/en/stable/reference.html?highlight=cache#git.index.fun.read_cache
> https://pypi.org/project/git-credential-helpers/
>
> But neither means appears to h
gnature to
`Pool.map(function, iterable, ... [, chunksize])`. This will bring true
equivalent to these functions.
Tell me what you think.
Pool.map:
https://docs.python.org/3/library/multiprocessing.html#multiprocessing.pool.Pool.map
map: https://docs.python.org/3/library/functions.html#map
Jason
My goal is to send messages to an AMQ server using Python 3.3. I found
Stompy and performed
2to3-3.3 before building. I am open to non-Stompy solutions.
My code:
from stompy.stomp import Stomp
my_stomp = Stomp(AMQ_HOST, AMQ_PORT)
my_stomp.connect(AMQ_USERNAME, AMQ_PASSWORD)
My error:
Traceback
>
> My error:
>> Traceback (most recent call last):
>> File "temp.py", line 8, in
>> my_stomp.connect(AMQ_USERNAME, AMQ_PASSWORD)
>> File "/lclapps/oppen/thirdparty/stompy/stomp.py", line 48, in connect
>> self.frame.connect(self.sock, username=username, password=password,
>> clientid=
>
> for message in mailbox.mbox(sys.argv[1]):
> if message.has_key("From") and message.has_key("To"):
> addrs = message.get_all("From")
> addrs.extend(message.get_all("To"))
> for addr in addrs:
> addrl = addr.lower()
>
>
> import subprocess
> import shlex
>
> domname = raw_input("Enter your domain name: ");
> print "Your domain name is: ", domname
>
> print "\n"
>
> # cmd='dig @4.2.2.2 nbc.com ns +short'
> cmd="dig @4.2.2.2 %s ns +short", % (domname)
> proc=subprocess.Popen(shlex.split(cmd),stdout=subprocess.PIPE
> I would like to use pdb in an application where it isn't possible to use
> sys.stdin for input. I've read in the documentation for pdb.Pdb that a file
> object can be used instead of sys.stdin. Unfortunately, I'm not clear about
> my options for the file object.
>
> I've looked at rpdb on PyPI
$ python
Python 3.6.0 (default, Dec 26 2016, 18:23:08)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> data = (
... (1,2),
... (3,4),
... )
>>> [a for a in data]
[(1, 2), (3, 4)]
Now, this puzzles me:
>>> [x,y for a in data]
File "", line 1
[x
> data = (
>> ... (1,2),
>> ... (3,4),
>> ... )
>>
> [x,y for a in data]
>> File "", line 1
>> [x,y for a in data]
>>^
>> SyntaxError: invalid syntax
>>
>> I expected:
>> [(1, 2), (3, 4)]
>
>
> Why would you expect that? I would expect the global variables x and y, or
> if
On Tue, Mar 6, 2018 at 1:52 AM, Kirill Balunov
wrote:
>
> I propose to delete all references in the `filter` documentation that the
> first argument can be `None`, with possible depreciation of `None` as the
> the first argument - FutureWarning in Python 3.8+ and deleting this option
> in Python
>
> > > I've written a function to return the months between date1 and date2
> but
> > > I'd like to know if anyone is aware of anything in the standard library
> > > to do the same? For bonus points, does anyone know if postgres can do
> > > the same (we use a lot of date/time funcitons in postgr
>
> >> > It's probably better to write the function yourself according to what
> >> > makes sense in your use-case, and document its behaviour clearly.
> >>
> >>
> > I suggest using the dateutil module (
> > https://pypi.python.org/pypi/python-dateutil) before writing your own.
>
> I'm not seeing a
>
> while 1:
> runner = os.popen("tracert -d www.hello.com")
> o=runner.read()
> print(o)
> runner.close()
> runner = os.popen("tracert -d www.hello.com")
> o=runner.read()
> print(o)
> runner.close()
> runner = os.popen("tracert -d www.hello.com")
> o=runner.read()
> print(o)
> runner.close()
>
>
$ python3
Python 3.6.1 (default, Apr 8 2017, 09:56:20)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import collections, datetime
>>> x = collections.defaultdict(int)
>>> x['something']
0
>>> x = collections.defaultdict(datetime.datetime)
>
> I am building up the microsite based on Bottle framework now.
> Any references/books? I am unfamiliar with this framework yet.
>
> I have used it with success. The online documentation was sufficient for
my needs, at least.
--
https://mail.python.org/mailman/listinfo/python-list
>
>
> > On 22 Aug 2018, at 8:38 am, Jason Friedman wrote:
> >
> >>
> >> I am building up the microsite based on Bottle framework now.
> >> Any references/books? I am unfamiliar with this framework yet.
> >>
> >> I have used it with
>
> the EmailMessage class of email.message provides the methods
> add_header() and __setitem__() to add a header to a message.
> add_header() effectively calls __setitem__(), which does
> `self._headers.append(self.policy.header_store_parse(name, val))`. This
> inserts the header at the bottom.
>
>
> So now the real question is: What were you trying to accomplish with
> the assignment? Tell us, and let's see if we can find a way to
> accomplish yor goal without wrecking the internals of the Grade class.
>
> And depending on your answer to that question, the new Data Classes
feature in 3.7
>
>- Create a method called `withdraw` that takes in cash withdrawal amount
>and updates the balance accordingly. if amount is greater than balance
>return `"invalid transaction"`
>
> def withdraw(self, amount):
> self.amount=amount
> if(amount > self.balance):
> return
> def deposit(self, amount):
> self.amount=amount
> self.balance += amount
> return self.balance
>
>
> def withdraw(self, amount):
> self.amount=amount
> if(amount > self.balance):
> return ("Amount greater than available balance.")
> else:
> self.balance -= amou
> for ping in range(1,254):
> address = "10.24.59." + str(ping)
> res = subprocess.call(['ping', '-c', '3', address])
> if res == 0:
> print ("ping to", address, "OK")
> elif res == 2:
> print ("no response from", address)
> else:
> print ("ping to", addr
> I added a line.
> I would need to put the output into a csv file which contained the results
> of the hosts up and down.
> Can you help me?
>
>
> import subprocess
> from ipaddress import IPv4Network
> for address in IPv4Network('10.24.59.0/24').hosts():
> a = str(address)
> res =
> I added a line.
> I would need to put the output into a csv file which contained the
> results of the hosts up and down.
> Can you help me?
>
> import subprocess
> from ipaddress import IPv4Network
> for address in IPv4Network('10.24.59.0/24').hosts():
> a = str(address)
> res = sub
up at all.
I'm going to try to download the 64-bit version and see if that helps.
Kind Regards,
Jason Honeycutt
--
https://mail.python.org/mailman/listinfo/python-list
> TL;DR: because we're all human, and human behaviour needs either
> immediate face-to-face feedback or social enforcement to correct
> selfishness and abrasiveness. Where face-to-face feedback is lacking,
> social enforcement needs to take more of the load.
>
>
> Many people have a false sense of
>
> def GetArgs():
> '''parse XML from command line'''
> parser = argparse.ArgumentParser()
>
> parser.add_argument("path", nargs="+")
> parser.add_argument('-e', '--extension', default='',
> help='File extension to filter by.')
> args = parser.parse_args
>
> Trying to extract the '1,1,114688:8192' pattern form the below output.
>
> pdb>stdout:
> '3aae5d0-1: Parent Block for 1,1,19169280:8192 (block 1,1,114688:8192)
> --\n3aae5d0-1:
> magic 0xdeaff2fe mark_cookie
> 0x\ngpal-3aae5d0-1: super.status
> 3s
regex matching on it. Anyone savvy
with this module that could steer me in the right direction???
Thanks
Jason
--
https://mail.python.org/mailman/listinfo/python-list
regex matching on it. Anyone savvy
with this module that could steer me in the right direction???
Thanks
Jason
--
https://mail.python.org/mailman/listinfo/python-list
>
> +1 for consistency, but I'm just fine with the short names. It's in the
> statistics module after all, so the context is very narrow and clear and
> people who don't know which to use or what the one does that they find in a
> given piece of code will have to read the docs and maybe fresh up th
On Wed, 27 Jul 2016 17:25:43 -0400, Larry Martell wrote:
> When I try and unpickle an object with pickle.loads it fails with:
>
> ImportError: Import by filename is not supported when unpickleing
>
> I've never used pickle before. Why do I get this and how can I fix it?
Try using *pickle.load*
On Wed, 27 Jul 2016 13:18:16 -0700, huey.y.jiang wrote:
> Hi Folks,
>
> It is common to put a BUTTON on a canvas by the means of coding.
> However, in my application, I need to draw a circle on canvas, and then
> make this circle to work as if it is a button. When the circle is
> clicked, it trig
>
> Log in to Activestate:
>
> https://code.activestate.com/recipes/langs/python/new/
>
> and click "Add a Recipe". I get
>
>
> Forbidden
>
> You don't have permission to access /recipes/add/ on this server.
> Apache Server at code.activestate.com Port 443
>
>
>
> Broken for everyone, or just for m
On Fri, Jan 18, 2019 at 5:22 PM Cameron Davidson-Pilon <
[email protected]> wrote:
> Hello! I invite you to participate in the Python Packages Survey - it takes
> less than a minute to complete, and will help open source developers
> understand their users' better. Thanks for participat
On Thu, Mar 14, 2019 at 8:07 AM Jack Dangler wrote:
>
>
> class weapon:
> weaponId
> manufacturerName
>
> def printWeaponInfo(self):
> infoString = "ID: %d Mfg: %s Model: %s" % (self.weaponId,
> self.manufacturerName)
> return infoString
>
>
>
> import class_wea
On Mon, Mar 25, 2019 at 11:03 PM Abdur-Rahmaan Janhangeer <
[email protected]> wrote:
> As proposed on python-ideas, i setup a repo to turn mail threads into
> articles.
>
> i included a script to build .md to .html (with syntax highlighting) here
> is the index
>
> https://abdur-rahmaanj.githu
>
> Pretty cool. FYI, the index page (now containing 4 articles) with Google
>> Chrome 72.0.3626.x prompts me to translate to French. The articles
>> themselves do not.
>>
>
> I'm now getting the translation offer on other web pages with Chrome, not
just this one.
Thus, please ignore my prior po
>
> If I have path: /home/admin/hello/yo/{h1,h2,h3,h4}
>
> import re
> r = re.search('{.}', path)
> # r should be ['h1,h2,h3,h4'] but I fail
>
> Why always search nothing?
>
A site like http://www.pyregex.com/ allows you to check your regex with
slightly fewer clicks and keystrokes than editing yo
ne: {fileinput.isfirstline()}")
I run this:
$ python3 program.py ~/Section*.csv > ~/result
I get this:
$ grep "^Version" ~/result
Version: sys.version_info(major=3, minor=7, micro=1, releaselevel='final',
serial=0)
$ grep "^Files" ~/result
Files: ['/home
>
> If you're certain that the headers are the same in each file,
> then there's no harm and much simplicity in reading them each
> time they come up.
>
> with fileinput ...:
> for line in f:
> if fileinput.isfirstline():
> headers = extract_headers(line)
>
> Chris Angelico: [PSF's] 2019 Q2 Community Service Award Winner
> http://pyfound.blogspot.com/2019/10/chris-angelico-2019-q2-community.html
>
> ...and for the many assistances and pearls of wisdom he has contributed
> 'here'!
> --
> Regards,
> =dn
>
> Agreed.
--
https://mail.python.org/mailman/
>
>
> When I define the X and Y values for prediction in the train and test
> data, should I capture all the columns that has been "OneHotEncoded" (that
> is all columns with 0 and 1) for the X and Y values???
>
You might have better luck asking on Stackoverflow, per the Pandas
instructions: https
>
>
> I have some lines in a text file like
> ADD R1, R2
> ADD3 R4, R5, R6
> ADD.MOV R1, R2, [0x10]
>
Actually I want to get 2 matches. ADD R1, R2 and ADD.MOV R1, R2, [0x10]
> because these two lines are actually "ADD" instructions. However, "ADD3" is
> something else.
>
>>> s = """ADD R1, R
You have another thread on this list that refers to general Python
installation issues, so you'll need to work through that.
I'm writing in this thread to say that tensorflow does not (today) support
Python 3.8, you'll want to try 3.7, assuming that tensorflow is a critical
piece for you: https://
>
> I constructed a lexicon for words that show how different words are linked
> to consumer traits and motivations (e.g. Achievement and Power Motivation).
> Now I have collected a large amount of online customer reviews and want to
> match each review with the word definitions of the consumer tra
I have some code I'm going to share with my team, many of whom are not yet
familiar with Python. They may not have 3rd-party libraries such as pandas
or selenium installed. Yes I can instruct them how to install, but the path
of least resistance is to have my code to check for missing dependencies
>
> import pandas; pd = pandas
>
> >df = pd.from_csv (...)
> >from selenium import webdriver
>
> import selenium.webdriver; webdriver = selenium.webdriver
>
Thank you, this works.
--
https://mail.python.org/mailman/listinfo/python-list
>
> I'm looking to insert values into an oracle table (my_table) using the
> query below. The insert query works when the PROJECT is not NULL/empty
> (""). However when PROJECT is an empty string(''), the query creates a new
> duplicate row every time the code is executed (with project value
> popu
I'm using the Box API (https://developer.box.com/guides/tooling/sdks/python/).
I can get an access token, though it expires after a certain amount of
time. My plan is to store the access token on the filesystem and use it
until it expires, then fetch a new one. In the example below assume I have
an
>
>
>> I'm using the Box API (
>> https://developer.box.com/guides/tooling/sdks/python/).
>> I can get an access token, though it expires after a certain amount of
>> time. My plan is to store the access token on the filesystem and use it
>> until it expires, then fetch a new one. In the example be
The Box API is noisy ... very helpful for diagnosing, and yet for
production code I'd like less noise.
I tried this:
warnings.filterwarnings(
action='ignore',
# category=Warning,
# module=r'boxsdk.*'
)
but I still see this:
WARNING:boxsdk.network.default_network:"POST
https://api.bo
>
> The Box API is noisy ... very helpful for diagnosing, and yet for
> production code I'd like less noise.
>
> I tried this:
>
> warnings.filterwarnings(
> action='ignore',
> # category=Warning,
> # module=r'boxsdk.*'
> )
>
> but I still see this:
>
> WARNING:boxsdk.network.default_ne
t_file:
reader = csv.DictReader(text_file)
for row in reader:
print(row)
Getting this error:
Traceback (most recent call last):
File "/home/jason/my_box.py", line 278, in
with io.TextIOWrapper(source_file.content(), encoding='utf-8') as
text_file:
AttributeError: 'bytes'
>
> csv.DictReader appears to be happy with a list of strings representing
> the lines.
>
> Try this:
>
> contents = source_file.content()
>
> for row in csv.DictReader(contents.decode('utf-8').splitlines()):
> print(row)
>
Works great, thank you! Question ... will this form potentially use l
>
> import numpy as np
> import pandas as pd
> from numpy.random import randn
> df=pd.DataFrame(randn(5,4),['A','B','C','D','E'],['W','X','Y','Z'])
>
> W X Y Z
> A -0.183141 -0.398652 0.909746 0.332105
> B -0.587611 -2.046930 1.446886 0.167606
> C 1.142661 -0.861617 -0.180631 1.650463
> D 1.174805
but this gave me:['this_NP is_VL funny_JJ']Try re.split, as in:import rere.split('_| ', mystr)-Jason--
http://mail.python.org/mailman/listinfo/python-list
many purposes. HTML is often "good enough" in a lot less time.
But if we get to the point where browsers are implementing inter-page
drag-and-drop (probably differently!) and so forth, some of us might
well decide it's simpler to go back to wxPython, etc.
Then again, m
cs.
Maybe I'm getting it mixed up with Perl regexen.
The upper() and lower() methods do work on accented characters in a
unicode string, so there has to be some recognition of unicode case
in there somewhere.
Thanks,
Jason
--
http://mail.python.org/mailman/listinfo/python-list
301 - 400 of 1047 matches
Mail list logo