meaning of numpy.fft coefficients
the list generated by numpy is of form [ a+bi, c+di, ...]
could anybody tell me the meaning of the coefficients a and b? I am
very confused about fourier transform!
information provided by numpy reference says Ak = Sum of a[m] *
exp{-2*pi * i * m * k / n} for m from 0 to n-1
Which part is a and which part is b and what is the meaning of each
part?
Thx in adv.
--
http://mail.python.org/mailman/listinfo/python-list
Fwd: Issues with pip installation on windows
-- Forwarded message -- From: Joey Steward Date: Mon, Sep 18, 2017 at 3:26 PM Subject: Issues with pip installation on windows To: [email protected] Hello, I'm a new programmer who initially began learning python for bioinformatics and data analysis applications, but have recently become interested by web development so I've set out to learn django. I used to use an ubuntu operating system when I was previously learning some aspects of bioinformatics but recently switched to a new computer with windows 10. I've been trying to use pip but continue getting an error message on the command line when I try to use pip (basically saying pip isn't a recognized command). I have been checking that pip installed though and up to date with the version of the python download I'm using ( was trying 3.6 and then switched to 2.7) so I feel it has something to do with how I have the setup that pip isn't being recognized, but I haven't been able to find any solutions with google searches. Is there any info out there that'd be good for a novice to check out to solve this? If so would greatly appreciate it! All the best, Joey Steward -- https://mail.python.org/mailman/listinfo/python-list
Issues with python commands in windows powershell
Hello, I've been having issues using basic python commands in windows powershell. I'm new to programming so just going off of online tutorials. Earlier I was unable to use pip to install Django (pip install Django), and came to this forum for help and someone was able to give me the correct command for windows 10 (py -m pip install django). I've been trying to run this command django-admin startproject mytests, but get the same error message as when trying to run the original pip django-admin : *The term 'django-admin' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,* *verify that the path is correct and try again.* *At line:1 char:1* + django-admin startproject mytestsite + + CategoryInfo : ObjectNotFound: (django-admin:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException I'm very new so honestly have no idea what the issue may be, but from previously trying to use python I think it may have something to do with configuring windows environment variables? Not sure, but just something I've ran into in the past previous times trying to learn python for more data analysis purposes. Any help would be greatly appreciated! Thanks a lot, Joey Steward -- https://mail.python.org/mailman/listinfo/python-list
Fwd: Issues with python commands in windows powershell
-- Forwarded message -- From: Joey Steward Date: Tue, Sep 19, 2017 at 10:30 PM Subject: Issues with python commands in windows powershell To: [email protected] Hello, I've been having issues using basic python commands in windows powershell. I'm new to programming so just going off of online tutorials. Earlier I was unable to use pip to install Django (pip install Django), and came to this forum for help and someone was able to give me the correct command for windows 10 (py -m pip install django). I've been trying to run this command django-admin startproject mytests, but get the same error message as when trying to run the original pip django-admin : *The term 'django-admin' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,* *verify that the path is correct and try again.* *At line:1 char:1* + django-admin startproject mytestsite + + CategoryInfo : ObjectNotFound: (django-admin:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException I'm very new so honestly have no idea what the issue may be, but from previously trying to use python I think it may have something to do with configuring windows environment variables? Not sure, but just something I've ran into in the past previous times trying to learn python for more data analysis purposes. Any help would be greatly appreciated! Thanks a lot, Joey Steward -- https://mail.python.org/mailman/listinfo/python-list
Fwd: Issues with python commands in windows powershell
-- Forwarded message -- From: Joey Steward Date: Wed, Sep 20, 2017 at 10:09 AM Subject: Fwd: Issues with python commands in windows powershell To: [email protected] -- Forwarded message -- From: Joey Steward Date: Tue, Sep 19, 2017 at 10:30 PM Subject: Issues with python commands in windows powershell To: [email protected] Hello, I've been having issues using basic python commands in windows powershell. I'm new to programming so just going off of online tutorials. Earlier I was unable to use pip to install Django (pip install Django), and came to this forum for help and someone was able to give me the correct command for windows 10 (py -m pip install django). I've been trying to run this command django-admin startproject mytests, but get the same error message as when trying to run the original pip django-admin : *The term 'django-admin' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,* *verify that the path is correct and try again.* *At line:1 char:1* + django-admin startproject mytestsite + + CategoryInfo : ObjectNotFound: (django-admin:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException I'm very new so honestly have no idea what the issue may be, but from previously trying to use python I think it may have something to do with configuring windows environment variables? Not sure, but just something I've ran into in the past previous times trying to learn python for more data analysis purposes. Any help would be greatly appreciated! Thanks a lot, Joey Steward -- https://mail.python.org/mailman/listinfo/python-list
Fwd: Issues with python commands in windows powershell
-- Forwarded message -- From: Joey Steward Date: Tue, Sep 19, 2017 at 10:30 PM Subject: Issues with python commands in windows powershell To: [email protected] Hello, I've been having issues using basic python commands in windows powershell. I'm new to programming so just going off of online tutorials. Earlier I was unable to use pip to install Django (pip install Django), and came to this forum for help and someone was able to give me the correct command for windows 10 (py -m pip install django). I've been trying to run this command django-admin startproject mytests, but get the same error message as when trying to run the original pip django-admin : *The term 'django-admin' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,* *verify that the path is correct and try again.* *At line:1 char:1* + django-admin startproject mytestsite + + CategoryInfo : ObjectNotFound: (django-admin:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException I'm very new so honestly have no idea what the issue may be, but from previously trying to use python I think it may have something to do with configuring windows environment variables? Not sure, but just something I've ran into in the past previous times trying to learn python for more data analysis purposes. Any help would be greatly appreciated! Thanks a lot, Joey Steward -- https://mail.python.org/mailman/listinfo/python-list
Issues with beginning Django use
Hello, I've been attempting to begin learning Django but have been having running Django and Python commands on windows. For example, when I run django-admin startproject mytestsite, I get the following error message django-admin : *The term 'django-admin' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,* *verify that the path is correct and try again.* *At line:1 char:1* + django-admin startproject mytestsite + + CategoryInfo : ObjectNotFound: (django-admin:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException Just curious if anyone has encountered a similar problem and can give some advice on getting moving in the right direction. Thanks a lot! -- https://mail.python.org/mailman/listinfo/python-list
Setting a Limit to the Maximum Size of an Upload
Hello,
I'm designing a small "briefcase" program that will allow me to quickly
upload, download, and delete files in a briefcase. The only real
things that I have left to do are to design a method for checking if
the file exists, preventing it from overwriting files from other
directories, and setting a user-configurable maximum limit on the
file's size. The former two, I can handle by myself with no problem.
However, the I'm having a little trouble with.
thefile = params["upfile.file"]
if os.path.getsize(thefile) <= conf["upmax"]:
print "File Size Okay." #Add Functions Later...
else:
print "File Too Large." #Here, too.
CGItb reported the following error:
TypeError: coercing to Unicode: need string or buffer, instance found
args = ('coercing to Unicode: need string or buffer, instance
found',)
This seems like an incredibly simple problem, but I just can't seem to
wrap my mind around it. Thank you for your help.
--
http://mail.python.org/mailman/listinfo/python-list
Re: Setting a Limit to the Maximum Size of an Upload
Here is a basic overview of the variables included there. params = cgi.FieldStorage() I accidentally made a mistake when typing what the "thefile" variable is. thefile = params["upfile"].file "upfile" is the CGI field that contains the file that I'm uploading. As you can see, the if statement just compares two values, os.path.getsize(thefile) and conf["upmax"], a variable I set that is designated as the maximum file size allowed. I'm assuming that this is all the information you need. I'm sorry for not including it earlier; I was in a bit of a rush. ^.^ -- http://mail.python.org/mailman/listinfo/python-list
Re: Setting a Limit to the Maximum Size of an Upload
I'm afraid on my interpreter, this works.
>>> if os.path.getsize("C:\\Documents and Settings\\Joey\\Desktop\\file.txt")
>>> <= 1000:
>>> print "<= 1000."
<= 1000.
No problems there, as you can see.
--
http://mail.python.org/mailman/listinfo/python-list
Re: Setting a Limit to the Maximum Size of an Upload
Oh, I'm sorry, I didn't understand what you meant at first. Then I read your reply over again and noticed that you said that the problem lied in os.path.getsize() when I tried to run it on the contents of an open file. I'll try the method you outlined now. -- http://mail.python.org/mailman/listinfo/python-list
Re: Setting a Limit to the Maximum Size of an Upload
Yes, I see that now. I tried your method and it seemed to work fine until I tried printing the filesize out. def checkfilesize(thefile): # Check the Size of the File global filesize thefile.seek(0,2) filesize = thefile.tell() thefile.seek(0) print filesize print conf["upmax"] if filesize <= conf["upmax"]: print "File Size Okay." noupload = False else: print "File is too Large." noupload = True Basically conf["upmax"] is a number that I extract from a configuration file that is the maximum size of an upload. I had tried setting conf["upmax"] to 1 and it should have technically disallowed a 28 byte file to pass through. But it did, so I added two lines to print the file size and the conf["upmax"] variable. The file size turned out to be "0"! thefile still is just params["upfile"].file, by the way. Any suggestions? -- http://mail.python.org/mailman/listinfo/python-list
Using win32ui.CreateFileDialog() to get the name of a file.
Hello. I'm writing a program that creates a series of batch operations to convert movies to be used on iPodLinux. The programs that do the encoding and conversions are seperate from mine and all mine does is use os.system() to call the program. However, it needs to get an input file and an output file. Originally I was using just raw input, but I got adventuresome and decided to try win32ui.CreateFileDialog(). But this will only open or save a file and its output will be either 1 or a failure. How might I go about using it to get the _file name_ of a file. For example. Box appears asking user to find a file they want. They double click on the file. Let's call it C:\Video.avi Then another dialog box appears asking them where to save it. They save it at C:\iPodVideo.avi. Now the Python program extracts the name of these files and then uses os.system() to run: mencoder.exe -[parameters] C:\Video.avi -o C:\iPodVideo.avi Note that I'm not actually inputting the contents of the file, I'm just passing the file name along. How might I do this? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Using win32ui.CreateFileDialog() to get the name of a file.
Okay, thank you. This worked very well. -- http://mail.python.org/mailman/listinfo/python-list
Re: Super Newbie Question
To reply to many of your messages (I'm using Google right now due to lack of a better newsreader at the moment), the issue with the temporary file is that when I write something new to it, if the old contents of the file was larger, not all of it will be overwritten. So, the truncate() method will work very well. Thank you Mr. Neuhauser, Mr. Ewing, and all others. -- http://mail.python.org/mailman/listinfo/python-list
Re: Best editor?
When I'm using Windows, I have found the Syn TextEditor (http://syn.sourceforge.net) to be quite useful. It has basic syntax highlighting, about enough for me and is quite compatible with FTP and such. It supports Python pretty well. Its user interface is quite easy yet pretty powerful. All in all, this is a very good editor, good enough that I probably won't go looking for another one any time soon. On Linux however (which I haven't used in quite some time, sadly), I usually use vim more than emacs. To tell you the truth, I haven't really used emacs that much at all, only for a short time. I keep meaning to actually try it out and get used to it, but I always find that if I need to edit a file quickly, I just go to vim. Then again, I don't write much Python code in Linux anyways. Even so, I intend to try emacs out soon. -- http://mail.python.org/mailman/listinfo/python-list
Stupid Newbie Question Concerning CGI and Reading Forward Slashes
Hi, I want to make a configuration script for something and it needs to read inputs from an HTML file. A couple of these inputs are textboxes that the user inputs a path in. For example: Your Home Directory: [/home/me/public_html/] So, I'm using Python to read these inputs and store them in a configuration file. However, I cannot get the CGI to read the forward slashes (/). It just leaves a blank area. So, for example: Input: /usr/bin/sendmail Reads: sendmail Input: /home/me/public_html/ Reads: (Nothing.) params = cgi.FieldStorage() def writep(key, name): if params.has_key(key): fconfig.write(name + ": " + os.path.split(params[key].value)[1] + ";\n") ^ This is the function for handling a key that is read by the cgi. The "name" is the name that it stores the key under so the configuration file looks like: name: key;[Line Break] However, is there a way to get it to read the forward slashes? If there isn't do you suggest having the user use a different character and adding a function in the script to substitute a forward slash for that character? I tried looking for this for a long while, but maybe I didn't search enough. Thanks for all of your help and I'm sorry if this is a question that has been asked 15 million times. Joey C. -- http://mail.python.org/mailman/listinfo/python-list
Re: Stupid Newbie Question Concerning CGI and Reading Forward Slashes
Steve Holden wrote: > It's not a common question, but it's relatively easily answered. You are > splitting everything but the filename off with os.path.split and then > complaining about the result! Once you stop doing that your problem is > solved. Thus, it's a stupid newbie question. Thanks a lot for your help. It seems I was just being plain stupid. -- http://mail.python.org/mailman/listinfo/python-list
python custom command interpreter?
I've got a hopefully simple question, maybe I'm just not searching for the right information. I'm working on a project that is using kickstarts to build Fedora/CentOS variant machines. Within the kickstart in the post section we will be performing disk space reductions by removing any unnecessary directories on the machine. In the end I'd like to be able to run a custom interpreter and just feed it one command and a directory. The end result in the kickstart something like this: %post --interpreter #!/usr/bin/myinterpreter DROP /tmp/directory DROP /tmp/directory2 How would I setup the interpreter to take the DROP command? I've been reading and searching all day but I haven't found anything close to what I'm doing. I realize that using custom commands in this case is overkill but in the end is used to make the users life easier. If anyone can point me to some documentation I would be more than grateful. Thanks, Joey -- http://mail.python.org/mailman/listinfo/python-list
Re: python custom command interpreter?
That's kinda what I'm looking for, but it can't be interactive as
there's no way to send input during the installation.
It should pass the DROP statements to the interpreter and the
interpreter takes the input and runs os.rmdir() or something similar.
This way the backend does all the work and the frontend
is easily configured for any user to add directories.
* %post --interpreter #!/usr/bin/myinterpreter
** DROP /tmp/directory
** DROP /tmp/directory2*
joey boggs wrote:
>* In the end I'd like to be able to run a custom interpreter and just feed
*>* it one command and a directory. The end result in the kickstart
*>* something like this:
*>*
*>* %post --interpreter #!/usr/bin/myinterpreter
*>* DROP /tmp/directory
*>* DROP /tmp/directory2
*>*
*>* How would I setup the interpreter to take the DROP command? I've been
*>* reading and searching all day but I haven't found anything close to what
*>* I'm doing. I realize that using custom commands in this case is overkill
*>* but in the end is used to make the users life easier. If anyone can
*>* point me to some documentation I would be more than grateful.
*
I'm not sure I understand what you're doing, but maybe you'll find the
following somewhat useful:
>>> import code
>>> class MyInterpreter(code.InteractiveConsole):
... def raw_input(self, prompt=None):
... # override input function
... while 1:
... text = raw_input(prompt)
... if text.startswith("DROP"):
... # deal with custom command
... print "CUSTOM DROP COMMAND", text
... else:
... return text
...
>>> i = MyInterpreter()
>>> i.interact()
Python 2.5.2 [...]
Type "help", "copyright", "credits" or "license" for more information.
(MyInterpreter)
>>> print "hello"
hello
>>> DROP something
CUSTOM DROP COMMAND DROP something
>>> x = 10
>>> y = 20
>>> x + y
30
>>> DROP something else
CUSTOM DROP COMMAND DROP something else
>>>
--
http://mail.python.org/mailman/listinfo/python-list
RE: python custom command interpreter?
-- Forwarded message --
From: joey boggs <[EMAIL PROTECTED]>
Date: Wed, Aug 20, 2008 at 9:46 PM
Subject: Re: python custom command interpreter?
To: Derek Martin <[EMAIL PROTECTED]>
That was my first approach, but it's not clean enough
-point at interpreter
- DROP /directory
That's my guidelines :(
joey boggs wrote:
>* That's kinda what I'm looking for, but it can't be interactive
* > as there's no way to send input during the installation.
>* It should pass the DROP statements to the interpreter and the
* > interpreter takes the input and runs os.rmdir()
> or something similar. This way the backend does all the
> work and the frontend
wouldn't it be easier to use a good old Unix shell for this? or just a
stock Python with some boilerplate code?
drop("/stuff")
drop("/otherstuff")
--
http://mail.python.org/mailman/listinfo/python-list
help: SIGABRT intermittent crash for threaded website crawleron python 2.4.4c1
I've been experiencing an intermittent crash where no python stacktrace is provided. It happens for a url downloading process that can last up to 12 hours and crawls about 50,000 urls. I'm using urllib2 for the downloads. There are 5-10 downloading threads, and some custom website exploration code for providing the urls to crawl. The downloads are completed in memory (not piped), then saved to a file. There are also nice per domain / IP guidelines upheld so lots of concurrent downloads and exploration are either waiting or taking place sometimes up to 40 at once. As a result, I've seen the process memory footprint clime upwards of 800 megs. About 20-40% of the time, the entire process bails out with no stacktrace, at random memory allocation and running time periods.. sometimes as little as 2 hours. My guess is that there is a bug in urllib2 or some third party software I'm using, or it was not meant to be run in a multithreaded environment. Decreasing the bandwidth/aggressiveness of the crawler MAY seem to have an effect on the frequency.. haven't done any formal 'studies' on that yet. My current solution is to restart the crawler, but this is bad business to the websites (recrawling), and extra crawl time on my part. I bet if I switch to a 1-download-per-process scenario with pyro for IPC (to uphold niceness rules, etc), I will fix this situation as I suspect from reading similar SIGABRT issues that it has something to do with the multi-threading. But I figured I'd ask around before I take such drastic measures. Since the process is so long-running, I have not tried running strace, and I'm not even sure if it would make sense to me or someone else. Let me know if you have a method of catching just the last 1000 calls and not saving earlier ones or whatever, if that would be useful. I'm using an older version of Python 2.4.4c1. Since the bug is intermittent, I'm not sure yet if an upgrade to Pyhton 2.5 has solved my problem. Does anyone have any clues for me to try? My threading code uses a messaging queue per thread, and one notification queue that the main thread checks and assigns new crawls back to free threads. No other variables are referenced by multiple threads other than the thread objects themselves (to my knowledge). -- http://mail.python.org/mailman/listinfo/python-list
help: SIGABRT intermittent crash for threaded website crawleron python 2.4.4c1
I've been experiencing an intermittent crash where no python stacktrace is provided. It happens for a url downloading process that can last up to 12 hours and crawls about 50,000 urls. I'm using urllib2 for the downloads. There are 5-10 downloading threads, and some custom website exploration code for providing the urls to crawl. The downloads are completed in memory (not piped), then saved to a file. There are also nice per domain / IP guidelines upheld so lots of concurrent downloads and exploration are either waiting or taking place sometimes up to 40 at once. As a result, I've seen the process memory footprint clime upwards of 800 megs. About 20-40% of the time, the entire process bails out with no stacktrace, at random memory allocation and running time periods.. sometimes as little as 2 hours. My guess is that there is a bug in urllib2 or some third party software I'm using, or it was not meant to be run in a multithreaded environment. Decreasing the bandwidth/aggressiveness of the crawler MAY seem to have an effect on the frequency.. haven't done any formal 'studies' on that yet. My current solution is to restart the crawler, but this is bad business to the websites (recrawling), and extra crawl time on my part. I bet if I switch to a 1-download-per-process scenario with pyro for IPC (to uphold niceness rules, etc), I will fix this situation as I suspect from reading similar SIGABRT issues that it has something to do with the multi-threading. But I figured I'd ask around before I take such drastic measures. Since the process is so long-running, I have not tried running strace, and I'm not even sure if it would make sense to me or someone else. Let me know if you have a method of catching just the last 1000 calls and not saving earlier ones or whatever, if that would be useful. I'm using an older version of Python 2.4.4c1. Since the bug is intermittent, I'm not sure yet if an upgrade to Pyhton 2.5 has solved my problem. Does anyone have any clues for me to try? My threading code uses a messaging queue per thread, and one notification queue that the main thread checks and assigns new crawls back to free threads. No other variables are referenced by multiple threads other than the thread objects themselves (to my knowledge). -- http://mail.python.org/mailman/listinfo/python-list
