Can you process seismographic signals in Python or should I switch to Matlab ?
My project https://www.mathworks.com/help/matlab/matlab_prog/loma-prieta-earthquake.html -- https://mail.python.org/mailman/listinfo/python-list
Re: Can you process seismographic signals in Python or should I switch to Matlab ?
On Sunday, 12 March 2023 at 06:17:54 UTC+1, [email protected] wrote: > I have used GNU Octave as a sort of replacement for MATLAB as a free > resource. I have no idea if it might meet your needs. > > Although Python is a good environment for many things, if you have no > knowledge of it yet, it can take a while to know enough and if you just need > it for one project, ... > -Original Message- > From: Python-list On > Behalf Of Thomas Passin > Sent: Sunday, March 12, 2023 12:02 AM > To: [email protected] > Subject: Re: Can you process seismographic signals in Python or should I > switch to Matlab ? > On 3/11/2023 6:54 PM, a a wrote: > > My project > > > https://www.mathworks.com/help/matlab/matlab_prog/loma-prieta-earthquake.htm > l > > If your goal is to step through this Matlab example, then clearly you > should use Matlab. If you do not have access to Matlab or cannot afford > it, then you would have to use something else, and Python would be a > prime candidate. However, each of the techniques and graphs in the > lesson have been pre-packaged for you in the Matlab case but not with > Python (many other case studies on various topics that use Python Python > can be found, though). > > Everything in the Matlab analysis can be done with Python and associated > libraries. You would have to learn various processing and graphing > techniques. You would also have to get the data from somewhere. It's > prepackaged for this analysis and you would have to figure out where to > get it. There is at least one Python package that can read and convert > Matlab files - I do not remember its name, though. > > A more important question is whether doing the Matlab example prepares > you to do any other analyses on your own. To shed some light on this, > here is a post on some rather more advanced analysis using data on the > same earthquake, done with Python tools - > > https://towardsdatascience.com/earthquake-time-series-forecasts-using-a-hybr > id-clustering-lstm-approach-part-i-eda-6797b22aed8c > -- > https://mail.python.org/mailman/listinfo/python-list Thank you my dear friends for your kind opinions. Matlab is pro, commercial, paid and demo is available for tests only. So it's hard to dicuss projects, apps in Matlab if cannot be verified by peers. What is hot today is the following 3D plot animation in Matplotlib https://twitter.com/gmrpetricca/status/1633477532526817281 But some unknown reasons Matplotlib and numpy crash my Python 3.8 for Windows , 32-bit and no support is offered Ok, I can read 100 research papers daily, preview hundreds pages of text from search engines. But what I need is analysis of seismograms from 4,000 seismographs world wide to detect P-wave energy distribution underground around the earthquake to verify EQ Domino Effect As you can see below, the Matlab project named in my first submission turned into Python project and EQ energy envelope makes sense. But I would prefer to join 100+ man project in seismology since it may take me months to download seismograms, process seismograms, preview, select features and build EQ energy envelope 3D plots for earthquakes in Turkey alone. To develop another theory, to get data, process data and get results for analysis to verify EQ energy envelope Domino Effect I am afraid there are no team research projects in seismology. What is published and discussed is one-man project. PICOSS: Python Interface for the Classification of Seismic Signals A. Buenoa, L. Zuccarellob,c, A. D ́ıaz-Morenod, J. Woolamd, M. Titosb, L. Garc ́ıaa, I. ́Alvareza, J. Prudenciob, S. De Angelisd aDepartment of Signal Theory, Telematic and Communications, University of Granada, Spain. bDepartment of Theoretical Physics and Cosmos, University of Granada, Spain. cIstituto Nazionale di Geofisica e Vulcanologia, Sezione di Pisa, Italy dDepartment of Earth, Ocean and Ecological Sciences, University of Liverpool, UK https://core.ac.uk/download/pdf/334413225.pdf seismic-signal https://github.com/topics/seismic-signal STA-LTA Algorithm and Seismometer Trajectory visualization in 3D Tonumoy / STA-LTA-Algorithm-and-Seismometer-Trajectory-visualization-in-3D https://github.com/Tonumoy/STA-LTA-Algorithm-and-Seismometer-Trajectory-visualization-in-3D PICOSS A Python Interface for the Classification of Seismic Signals. PICOSS is a Python GUI designed as a modular data-curator platform for volcano-seismic data analysis. Detection, segmentation and classification. With exportability and standardization at its core, users can select automatic or manual workflows to annotate seismic data from the suite of included tools. Originally, PICOSS was designed for the purposes of seismicity research as a collaboration between University of Granada (UGR) and Univer
Re: Can you process seismographic signals in Python or should I switch to Matlab ?
On Monday, 13 March 2023 at 16:16:28 UTC+1, Thomas Passin wrote: > On 3/13/2023 12:39 AM, a a wrote: > > But what I need is analysis of seismograms from 4,000 seismographs world > > wide to detect P-wave energy distribution underground around the earthquake > > to verify EQ Domino Effect > In that case, you will have to do a great deal of work to get all that > data into a common usable form, cleaned and errors removed. That will > be a lot of effort no matter what language you use. In the Matplotlib > lesson you pointed to, the work was already done, for one one earthquake > at one location. > > The reference I gave, > https://towardsdatascience.com/earthquake-time-series-forecasts-using-a-hybr > > id-clustering-lstm-approach-part-i-eda-6797b22aed8c > > actually includes a Python script that does this work for some selected > ranges of data, so it might be a good starting point. Thank you excellent example "The imported json files were heavily-nested; hence, during data cleaning, I “denested” the json files, transformed them into dataframes, fixed the column datatypes, imputed the NaN values, and finally concatenated them into a global dataframe, which was workable. For a full description of data cleaning, visit my GitHub profile. Finally, I indexed the dataframe by timestamps as a time-series dataframe: https://towardsdatascience.com/earthquake-time-series-forecasts-using-a-hybrid-clustering-lstm-approach-part-i-eda-6797b22aed8c I would like to work with Saied Mighani one day but unfortunately, seismology projects, studies are one-man activity. I am success oriented in building Earthquake Prediction System and I am sure, P-wave energy envelope calculate for every earthquake, for every seismographic station can give valuable hints on how earthquake energy is distributed underground, since what is recorded by surface seismographs is some form of such P-wave envelope energy transferred at the direction of surface placed seismograph. Ideas are great but life is for real ;) thank you -- https://mail.python.org/mailman/listinfo/python-list
Re: Can you process seismographic signals in Python or should I switch to Matlab ?
On Monday, 13 March 2023 at 16:12:04 UTC+1, Thomas Passin wrote: > On 3/13/2023 12:39 AM, a a wrote: > > But some unknown reasons Matplotlib and numpy crash my Python 3.8 for > > Windows , 32-bit and no support is offered > It is possible, using pip, to downgrade versions (e.g., of Matplotlob > and numpy) to see if you can find versions that work. Of course moving > to 64-bit Python >= 3.10 would be better, but if that were possible I > imagine you would have done it already. > > BTW, it would be useful if you said what operating system you are using > (I've been assuming Windows). sorry Windows 7 My concept in building Earthquake Prediction System based on Precognition is to use RTL Software Defined Radio (SDR) to receive data from outdoor seismic sensors (smartphones turned into seismographs - sending acceleration data via audio output, to be transmitted by radio transmitter to a remote RTL SDR station, for real time processing, P-wave energy envelope calculation, earthquake depth calculation sine in case of Turkey, USGS assigns 10km depth value by default to a single EQ event. Why SDR ? Since I don't expect Cellular network to work and be operational in remote, mountain regions of Turkey after the strong 7,8 earthquake, so SDR should work as backup for cellular 3G/LTE network in the region. In case of Android smartphones I need to switch to Python for Android to get flexibility offered by scripting to support earthquake study ideas just in time and to share such ideas with friends. --- python-for-android · PyPI https://pypi.org/project/python-for-android python-for-android is a packaging tool for Python apps on Android. You can create your own Python distribution including the modules and dependencies you want, and bundle it in an APK or AAB along with your own code. Features include: Different app backends including Kivy, PySDL2, and a WebView with Pyt… See more Documentation Follow the quickstartinstructionsto install and begin creating APKs and AABs. Quick instructions: install python-for-android with: (for the develop branch: pip install git+https://github.com/kivy/… See more Contributing We love pull requests and discussing novel ideas. Check out the Kivyproject contribution guideandfeel free to improve python-for-android. See ou… See more Support If you need assistance, you can ask for help on our mailing list: 1. User Group: https://groups.google.com/group/kivy-users 2. Email: [email protected] … See more History In 2015 these tools were rewritten to provide a new, easier-to-use andeasier-to-extend interface. If you'd like to browse the old toolchain, itsstatus is re… See more Explore further Global web icon Is there a way to run Python on Android? - Stack Overflow stackoverflow.com Global web icon How to Download and Install Python for Android mptricks.com Global web icon How to develop Android app completely using python? stackoverflow.com Global web icon How to download and install Python Latest Version on An… geeksforgeeks.org Global web icon An Introduction to Python for Android Development pythonpool.com Recommended to you based on what's popular • Feedback From pypi.org Content Documentation Support Contributing History Create and run Python apps on your Android phone https://opensource.com/article/20/8/python-android... WebAug 26, 2020 · $ pkg install python Once the installation and auto set-up of configuration is complete, it’s time to build your application. Build an app for Android on Android Now that you have a terminal installed, you can … GitHub - kivy/python-for-android: Turn your Python application … https://github.com/kivy/python-for-android Webpython-for-android is a packaging tool for Python apps on Android. You can create your own Python distribution including the modules and dependencies you want, and bundle it in an APK or AAB along with your … When did Python 2 stop supporting Android? See this and other topics on this result An introduction to Python on Android - Android Authority https://www.androidauthority.com/an-introduction... WebMar 31, 2017 · Python is a particularly simple and elegant coding language that is designed with the beginner in mind. The problem is that learning to … Reviews: 8 Estimated Reading Time: 9 mins Android - Python Wiki https://wiki.python.org/moin/Android WebThere are several ways to use Python on Android. The following table summarizes those projects which are currently active: BeeWare is a toolkit for developing cross-platform … People also ask How to run Python on Android?Create and run Python apps on your Android phone 1 Install Termux on Android. First, install the Termux application. ... 2 Build an app for Android on Android. Now that you have a terminal installed, you can work on your Android phone largely as if it were just another Linux computer. 3 Write Python code on Android. You're
Numpy, Matplotlib crash Python 3.8 Windows 7, 32-bit - can you help ?
Crash report: Problem Caption: Problem Event Name: APPCRASH Application name: python.exe Application version: 3.8.7150.1013 Application time signature: 5fe0df5a Error module name:_multiarray_umath.cp38-win32.pyd Version of the module with the error: 0.0.0.0 Time signature of the module with the error: 63dfe4cf Exception code: c01d Exception offset: 000269c9 Operating system version: 6.1.7601.2.1.0.256.48 Regional Settings ID: 1045 Additional information 1: 0a9e Additional information 2: 0a9e372d3b4ad19135b953a78882e789 Additional information 3: 0a9e Additional information 4: 0a9e372d3b4ad19135b953a78882e789 -- https://mail.python.org/mailman/listinfo/python-list
Re: Numpy, Matplotlib crash Python 3.8 Windows 7, 32-bit - can you help ?
On Friday, 17 March 2023 at 16:32:53 UTC+1, a a wrote:
> On Friday, 17 March 2023 at 16:03:14 UTC+1, Thomas Passin wrote:
> > On 3/16/2023 8:07 PM, a a wrote:
> > > Crash report:
> > >
> > > Problem Caption:
> > > Problem Event Name: APPCRASH
> > > Application name: python.exe
> > > Application version: 3.8.7150.1013
> > > Application time signature: 5fe0df5a
> > > Error module name: _multiarray_umath.cp38-win32.pyd
> > > Version of the module with the error: 0.0.0.0
> > > Time signature of the module with the error: 63dfe4cf
> > > Exception code: c01d
> > > Exception offset: 000269c9
> > > Operating system version: 6.1.7601.2.1.0.256.48
> > > Regional Settings ID: 1045
> > > Additional information 1: 0a9e
> > > Additional information 2: 0a9e372d3b4ad19135b953a78882e789
> > > Additional information 3: 0a9e
> > > Additional information 4: 0a9e372d3b4ad19135b953a78882e789
> > This exception has been reported to have many causes, but one
> > possibility seems to be that your computer may not support an advanced
> > instruction set that the .pyd was compiled for. I found this one
> > specifically mentioned on the Internet: Advanced Vector Extensions. If
> > that were the case, you would either need to find a different version of
> > the module, or upgrade the computer/OS.
> >
> > It would be worth trying to downgrade the multiarray version to an
> > earlier one and see if that fixes the problem.
> Thank you Thomas
> for your kind reply.
>
> I am fully aware to be living on an old machine, old OS, Windows 7, 32-bit
> system
> but I have visited every social chat support forum on the Internet: from
> Python to Matplotlib, Numpy, Twitter, Github.
>
> As a newbie I am not aware how to downgrade "the multiarray version to an
> earlier one
>
> I simply tried to test Python code from
>
>
> https://www.section.io/engineering-education/reading-and-processing-android-sensor-data-using-python-with-csv-read/
>
>
>
> # Python program to read .csv file
>
> import numpy as np
> import matplotlib.pyplot as plt
> import csv
>
>
> "After importing the libraries, we now read the .csv file:
>
> with open('accl1.csv', 'r') as f:
> data = list(csv.reader(f, delimiter=',')) #reading csv file
>
>
> Just read about AVE from Wikipedia
>
> https://en.wikipedia.org/wiki/Advanced_Vector_Extensions
downloaded and run
HWiNFO
and AVE not supported, not greened out
--
https://mail.python.org/mailman/listinfo/python-list
Re: Numpy, Matplotlib crash Python 3.8 Windows 7, 32-bit - can you help ?
On Friday, 17 March 2023 at 16:03:14 UTC+1, Thomas Passin wrote:
> On 3/16/2023 8:07 PM, a a wrote:
> > Crash report:
> >
> > Problem Caption:
> > Problem Event Name: APPCRASH
> > Application name: python.exe
> > Application version: 3.8.7150.1013
> > Application time signature: 5fe0df5a
> > Error module name: _multiarray_umath.cp38-win32.pyd
> > Version of the module with the error: 0.0.0.0
> > Time signature of the module with the error: 63dfe4cf
> > Exception code: c01d
> > Exception offset: 000269c9
> > Operating system version: 6.1.7601.2.1.0.256.48
> > Regional Settings ID: 1045
> > Additional information 1: 0a9e
> > Additional information 2: 0a9e372d3b4ad19135b953a78882e789
> > Additional information 3: 0a9e
> > Additional information 4: 0a9e372d3b4ad19135b953a78882e789
> This exception has been reported to have many causes, but one
> possibility seems to be that your computer may not support an advanced
> instruction set that the .pyd was compiled for. I found this one
> specifically mentioned on the Internet: Advanced Vector Extensions. If
> that were the case, you would either need to find a different version of
> the module, or upgrade the computer/OS.
>
> It would be worth trying to downgrade the multiarray version to an
> earlier one and see if that fixes the problem.
Thank you Thomas
for your kind reply.
I am fully aware to be living on an old machine, old OS, Windows 7, 32-bit
system
but I have visited every social chat support forum on the Internet: from Python
to Matplotlib, Numpy, Twitter, Github.
As a newbie I am not aware how to downgrade "the multiarray version to an
earlier one
I simply tried to test Python code from
https://www.section.io/engineering-education/reading-and-processing-android-sensor-data-using-python-with-csv-read/
# Python program to read .csv file
import numpy as np
import matplotlib.pyplot as plt
import csv
"After importing the libraries, we now read the .csv file:
with open('accl1.csv', 'r') as f:
data = list(csv.reader(f, delimiter=',')) #reading csv file
Just read about AVE from Wikipedia
https://en.wikipedia.org/wiki/Advanced_Vector_Extensions
--
https://mail.python.org/mailman/listinfo/python-list
Re: Numpy, Matplotlib crash Python 3.8 Windows 7, 32-bit - can you help ?
On Friday, 17 March 2023 at 16:03:14 UTC+1, Thomas Passin wrote: > On 3/16/2023 8:07 PM, a a wrote: > > Crash report: > > > > Problem Caption: > > Problem Event Name: APPCRASH > > Application name: python.exe > > Application version: 3.8.7150.1013 > > Application time signature: 5fe0df5a > > Error module name: _multiarray_umath.cp38-win32.pyd > > Version of the module with the error: 0.0.0.0 > > Time signature of the module with the error: 63dfe4cf > > Exception code: c01d > > Exception offset: 000269c9 > > Operating system version: 6.1.7601.2.1.0.256.48 > > Regional Settings ID: 1045 > > Additional information 1: 0a9e > > Additional information 2: 0a9e372d3b4ad19135b953a78882e789 > > Additional information 3: 0a9e > > Additional information 4: 0a9e372d3b4ad19135b953a78882e789 > This exception has been reported to have many causes, but one > possibility seems to be that your computer may not support an advanced > instruction set that the .pyd was compiled for. I found this one > specifically mentioned on the Internet: Advanced Vector Extensions. If > that were the case, you would either need to find a different version of > the module, or upgrade the computer/OS. > > It would be worth trying to downgrade the multiarray version to an > earlier one and see if that fixes the problem. Just reading from search engine: https://www.bing.com/search?q=how+to+downgrade+_multiarray_umath.cp38-win32.pyd+&form=QBLH&sp=-1&lq=0&pq=how+to+downgrade+_multiarray_umath.cp38-win32.pyd+&sc=1-50&qs=n&sk= -- https://mail.python.org/mailman/listinfo/python-list
Re: Numpy, Matplotlib crash Python 3.8 Windows 7, 32-bit - can you help ?
On Saturday, 18 March 2023 at 20:12:22 UTC+1, Thomas Passin wrote:
> On 3/17/2023 11:52 AM, a a wrote:
> > On Friday, 17 March 2023 at 16:32:53 UTC+1, a a wrote:
> >> On Friday, 17 March 2023 at 16:03:14 UTC+1, Thomas Passin wrote:
> >>> On 3/16/2023 8:07 PM, a a wrote:
> >>>> Crash report:
> >>>>
> >>>> Problem Caption:
> >>>> Problem Event Name: APPCRASH
> >>>> Application name: python.exe
> >>>> Application version: 3.8.7150.1013
> >>>> Application time signature: 5fe0df5a
> >>>> Error module name: _multiarray_umath.cp38-win32.pyd
> >>>> Version of the module with the error: 0.0.0.0
> >>>> Time signature of the module with the error: 63dfe4cf
> >>>> Exception code: c01d
> >>>> Exception offset: 000269c9
> >>>> Operating system version: 6.1.7601.2.1.0.256.48
> >>>> Regional Settings ID: 1045
> >>>> Additional information 1: 0a9e
> >>>> Additional information 2: 0a9e372d3b4ad19135b953a78882e789
> >>>> Additional information 3: 0a9e
> >>>> Additional information 4: 0a9e372d3b4ad19135b953a78882e789
> >>> This exception has been reported to have many causes, but one
> >>> possibility seems to be that your computer may not support an advanced
> >>> instruction set that the .pyd was compiled for. I found this one
> >>> specifically mentioned on the Internet: Advanced Vector Extensions. If
> >>> that were the case, you would either need to find a different version of
> >>> the module, or upgrade the computer/OS.
> >>>
> >>> It would be worth trying to downgrade the multiarray version to an
> >>> earlier one and see if that fixes the problem.
> >> Thank you Thomas
> >> for your kind reply.
> >>
> >> I am fully aware to be living on an old machine, old OS, Windows 7, 32-bit
> >> system
> >> but I have visited every social chat support forum on the Internet: from
> >> Python to Matplotlib, Numpy, Twitter, Github.
> >>
> >> As a newbie I am not aware how to downgrade "the multiarray version to an
> >> earlier one
> >>
> >> I simply tried to test Python code from
> >>
> >>
> >> https://www.section.io/engineering-education/reading-and-processing-android-sensor-data-using-python-with-csv-read/
> >>
> >>
> >>
> >> # Python program to read .csv file
> >>
> >> import numpy as np
> >> import matplotlib.pyplot as plt
> >> import csv
> >>
> >>
> >> "After importing the libraries, we now read the .csv file:
> >>
> >> with open('accl1.csv', 'r') as f:
> >> data = list(csv.reader(f, delimiter=',')) #reading csv file
> >>
> >>
> >> Just read about AVE from Wikipedia
> >>
> >> https://en.wikipedia.org/wiki/Advanced_Vector_Extensions
> >
> >
> > downloaded and run
> > HWiNFO
> > and AVE not supported, not greened out
> That's too bad; you may be out of luck. It's possible that someone has
> compiled the .pyd library in such a way that it does not need the
> instruction set extensions. I'm sorry but I don't know how to find out
> except by trying internet searches - or by downgrading to earlier
> versions of Numpy hoping to find one that works and also can be used by
> the other libraries/programs that need to use it.
Thank you Thomas for youre kind help.
You are the real Python PRO, you deserve Nobel Prize in Python.
I operated an old Dell computer with Windows XP preinstalled
and upgraded XP to Windows 7 to get some web services to work.
Unfortunately I failed to find and install driver for video controller since
none supported by Dell.
Visited many driver sites (Intel Driver Assistant included and more)
without any success.
So life with an old PC is not easy
--
https://mail.python.org/mailman/listinfo/python-list
Re: Numpy, Matplotlib crash Python 3.8 Windows 7, 32-bit - can you help ?
On Thursday, 23 March 2023 at 22:15:10 UTC+1, Thomas Passin wrote: > On 3/23/2023 3:38 PM, Mats Wichmann wrote: > > On 3/23/23 09:48, Thomas Passin wrote: > > > >> I didn't realize that Christoph Gohlke is still maintaining this site. > > > > Unless the the last-changed stuff stopped working, it's in a static state: > > > > by Christoph Gohlke. Updated on 26 June 2022 at 07:27 UTC > I did see that. The OP needs a version that would work with Windows 7 > and an older version of Python (3.7 or 3.8, IIRC), so things may work out. Thank you Thomas for your excellent work you did for me. Ok, I know, I need to switch to Windows 10 run on another PC next to me. I need to learn how to copy and move every web page opened in Firefox as a reference to social media, web sites for Python, chat and more (about 50 web pages live opened ;) I really love the limited functionality of w3schools to let me live open and run Python examples, especiallly Matplotlib examples. Unfortunately chat forum at w3schools is low traffic, showing no interest to add more examples. https://www.w3schools.com/python/trypython.asp?filename=demo_matplotlib_subplots3 https://www.w3schools.com/python/matplotlib_subplot.asp thank you Thomas, darius -- https://mail.python.org/mailman/listinfo/python-list
Re: Numpy, Matplotlib crash Python 3.8 Windows 7, 32-bit - can you help ?
On Monday, 27 March 2023 at 19:19:41 UTC+2, Thomas Passin wrote: > On 3/27/2023 10:07 AM, a a wrote: > > Ok, I know, I need to switch to Windows 10 run on another PC next to me. > > > > I need to learn how to copy and move every web page opened in Firefox as a > > reference to social media, web sites for Python, chat and more (about 50 > > web pages live opened 😉 > > This sounds like you mean when you get a new Windows 10 PC, you will > want to move your open tabs to the new machine. I see several > possibilities for this. > > 1. Copy your Firefox profile folder to the new computer, and tell > Firefox to use it as the default profile. I *think* this will include > the open tabs, but I haven't tried it. Saving that folder is useful for > backup anyway. (If you use Thunderbird for email, you really *must* > back up its profile folder because all your email with its folder > structure is there. BTW, you can even copy the profile over to a Linux > machine that has Thunderbird, and presto, all your email will be there. > The Firefox profile would probably transfer just as well). > > 2. Bookmark all your open tabs under a new heading "open tabs", then > export the bookmarks. In the new machine, import them into Firefox > there. They won't open in tabs, but it will be easy to find them and > open them when you want to. You probably will want to copy over your > bookmarks anyway, so this adds little effort. > > 3. There may be a specific record of open tabs that you can copy or > export. I don't know about this but an internet search should help. > > Good luck. a nice solution comes from How to Copy URLs of All Open Tabs in Firefox https://www.howtogeek.com/723921/how-to-copy-urls-of-all-open-tabs-in-firefox/ right clicking opened tab, all opened tabs can be selected moving via menu to bookmarks/ booksmarks management url bookmarks can be right-mouse clicked to copy urls finally, urls can be pasted into Notepad++ and saved as a file unfortunately, saving as .html file fails to generate html file with clickable web links Notepad++ keeps urls active, selectable but not ready to be opened in Firefox so I need to learn how to make Notepad++ or another editor to save urls as html file BTW Selecting all opened tabs I get 1,000+ active urls (opened web pages ), so something must be wrong -- https://mail.python.org/mailman/listinfo/python-list
Re: Numpy, Matplotlib crash Python 3.8 Windows 7, 32-bit - can you help ?
On Tuesday, 28 March 2023 at 02:07:43 UTC+2, Thomas Passin wrote: > On 3/27/2023 4:02 PM, Thomas Passin wrote: > > On 3/27/2023 3:07 PM, a a wrote: > >> On Monday, 27 March 2023 at 19:19:41 UTC+2, Thomas Passin wrote: > >>> On 3/27/2023 10:07 AM, a a wrote: > >>>> Ok, I know, I need to switch to Windows 10 run on another PC next to > >>>> me. > >>>> > >>>> I need to learn how to copy and move every web page opened in > >>>> Firefox as a reference to social media, web sites for Python, chat > >>>> and more (about 50 web pages live opened 😉 > >>> > >>> This sounds like you mean when you get a new Windows 10 PC, you will > >>> want to move your open tabs to the new machine. I see several > >>> possibilities for this. > >>> > >>> 1. Copy your Firefox profile folder to the new computer, and tell > >>> Firefox to use it as the default profile. I *think* this will include > >>> the open tabs, but I haven't tried it. Saving that folder is useful for > >>> backup anyway. (If you use Thunderbird for email, you really *must* > >>> back up its profile folder because all your email with its folder > >>> structure is there. BTW, you can even copy the profile over to a Linux > >>> machine that has Thunderbird, and presto, all your email will be there. > >>> The Firefox profile would probably transfer just as well). > >>> > >>> 2. Bookmark all your open tabs under a new heading "open tabs", then > >>> export the bookmarks. In the new machine, import them into Firefox > >>> there. They won't open in tabs, but it will be easy to find them and > >>> open them when you want to. You probably will want to copy over your > >>> bookmarks anyway, so this adds little effort. > >>> > >>> 3. There may be a specific record of open tabs that you can copy or > >>> export. I don't know about this but an internet search should help. > >>> > >>> Good luck. > >> > >> a nice solution comes from > >> > >> How to Copy URLs of All Open Tabs in Firefox > >> > >> https://www.howtogeek.com/723921/how-to-copy-urls-of-all-open-tabs-in-firefox/ > >> > >> > >> right clicking opened tab, all opened tabs can be selected > >> moving via menu to bookmarks/ booksmarks management > >> url bookmarks can be right-mouse clicked to copy urls > >> finally, urls can be pasted into Notepad++ > >> and saved as a file > >> unfortunately, saving as .html file > >> fails to generate html file with clickable web links > >> > > > > Don't go pasting urls into a text file one by one. Instead, do my #2 > > above. That will import all the bookmarks, including the tabs you saved > > as bookmarks. Then import the exported bookmark file into the new > > browser. There's no reason to fuss around trying to get text copies of > > urls to open. > > > > For that matter, the exported bookmarks file is an HTML file and can be > > opened directly in a browser, with clickable links. > All right, I think I've got the easiest way to go. You *can* bookmark > all the tabs at once - see below. Then, as I already proposed, export > the bookmarks and import them into Firefox on the new computer. > > To save the tabs, right click any one of them and select the "Select All > Tabs" item. They will all highlight. Right click on one of them and > select the "Bookmark Tabs" item. A dialog box will open with an entry > lone for the Name to use (like "Tabset1") and a location - a bookmark > folder - for them to go into. CAREFUL - if you just click "Save", you > may not be able to find them. Use the dropdown arrow to save them in > one of the top level folders, like "Bookmarks Toolbars". I can select All Opened Tabs (as from the given link) and get 1,000+ Opened Tabs ( I am afraid, this is s number of all saved bookmarks in the past) I go to menu, Bookmarks, Manage Boomarks and copy Tabs and https://www.textfixer.com/html/convert-url-to-html-link.php does the job, converting text urls into clickable web links I copy the result and past into Notepad++ to save file as html and what I get is web page of clickable Opened Tabs since icon and page name are lost I would prefer another solution already ofered by Firex to generate web page of recently visited web pages, unfortunately coming with limits on the number of visited web pages, so I contacted Firefox, Notepad++ for help -- https://mail.python.org/mailman/listinfo/python-list
Re: Numpy, Matplotlib crash Python 3.8 Windows 7, 32-bit - can you help ?
On Tuesday, 28 March 2023 at 06:33:44 UTC+2, Thomas Passin wrote: > On 3/27/2023 8:37 PM, a a wrote: > >> To save the tabs, right click any one of them and select the "Select All > >> Tabs" item. They will all highlight. Right click on one of them and > >> select the "Bookmark Tabs" item. A dialog box will open with an entry > >> lone for the Name to use (like "Tabset1") and a location - a bookmark > >> folder - for them to go into. CAREFUL - if you just click "Save", you > >> may not be able to find them. Use the dropdown arrow to save them in > >> one of the top level folders, like "Bookmarks Toolbars". > > I can select All Opened Tabs (as from the given link) > > and get 1,000+ Opened Tabs ( I am afraid, this is s number of all saved > > bookmarks in the past) > > I go to menu, Bookmarks, Manage Boomarks and copy Tabs > > > > and > > https://www.textfixer.com/html/convert-url-to-html-link.php > > > > does the job, converting text urls into clickable web links > > > > I copy the result and past into Notepad++ to save file as html > > > > and what I get is web page of clickable Opened Tabs > > > > since icon and page name are lost > I don't understand this. You don't really have 1000 tabs open at the > same time, do you? If you select all the open tabs - I think you wrote > that you only have 50 - then you can save them as bookmarks under a > folder name you choose. That folder will contain the 50 open links. I > tried it this evening, so I know that's how it works. (It happens that > I'm working on my own bookmark manager just now, so I've been messing > around with importing, exporting, and reading the bookmark files). > > Then you can export them and import the same bookmark file into another > browser on another computer. Whenever you want to reopen some of those > tabs, you would navigate to that part of the bookmarks and open the tabs > you want. > > Maybe you have something else in mind? Do you want to send the links of > the opened tab set to someone else, but not all your bookmarks? Please > explain more carefully what you want to do. Ok, I was not aware of the real number of the opened Tabs in Firefox, since I can jump from left to right and vice versa in real time, so the number given by me: 50 opened Tabs was my general estimate, but I can read the real number of opened Tabs from the same menu (line below) to be 1,000+ What I copy and paste into Notepad++ is 1,000+ -line file. It's hard to verify if the above number is made of opened Tabs only or bookmarks are included, since I exactly use and keep multi Tabs opened as my live bookmarks and cache memory, when I work on my projects (watching, counting sunspots, Earthquakes prediction in Turkey, ... ) I would like to fund the development of such smart Tabs Manager to replace boomarks, to let me group Tabs belonging to different projects. It doesn't look to be complicated, if supported by the Firefox team. Firefox 97. comes with alike functionality (when I open a new Tab) but limited to 4 rows of web-page icons + names and 4 rows called: Recent activity All I need is to replace opened Tabs by history of the Recent activity - default Firefox page, when I open a new Tab It's hard to imagine, I can have 1,000+ Tabs live opened in Firefox but I really need such feature, called in the past as: MyLifeBits by MS So I have to ask Firefox team today to lift 4 rows limit on web links and 4 rows limit on the recent activity, coming with New Tab opened When I am busy on a project I can open 100+ web pages via search engine in one day and would prefer 100+ opened Tabs to be saved in html format for the records as a reference. Hope to get some support from Firefox team via Twitter. Ok, smart bookmarks manager can offer the above functionality right now, so I go to search engine to get one. darius -- https://mail.python.org/mailman/listinfo/python-list
Re: Numpy, Matplotlib crash Python 3.8 Windows 7, 32-bit - can you help ?
On Tuesday, 28 March 2023 at 06:33:44 UTC+2, Thomas Passin wrote: > On 3/27/2023 8:37 PM, a a wrote: > >> To save the tabs, right click any one of them and select the "Select All > >> Tabs" item. They will all highlight. Right click on one of them and > >> select the "Bookmark Tabs" item. A dialog box will open with an entry > >> lone for the Name to use (like "Tabset1") and a location - a bookmark > >> folder - for them to go into. CAREFUL - if you just click "Save", you > >> may not be able to find them. Use the dropdown arrow to save them in > >> one of the top level folders, like "Bookmarks Toolbars". > > I can select All Opened Tabs (as from the given link) > > and get 1,000+ Opened Tabs ( I am afraid, this is s number of all saved > > bookmarks in the past) > > I go to menu, Bookmarks, Manage Boomarks and copy Tabs > > > > and > > https://www.textfixer.com/html/convert-url-to-html-link.php > > > > does the job, converting text urls into clickable web links > > > > I copy the result and past into Notepad++ to save file as html > > > > and what I get is web page of clickable Opened Tabs > > > > since icon and page name are lost > I don't understand this. You don't really have 1000 tabs open at the > same time, do you? If you select all the open tabs - I think you wrote > that you only have 50 - then you can save them as bookmarks under a > folder name you choose. That folder will contain the 50 open links. I > tried it this evening, so I know that's how it works. (It happens that > I'm working on my own bookmark manager just now, so I've been messing > around with importing, exporting, and reading the bookmark files). > > Then you can export them and import the same bookmark file into another > browser on another computer. Whenever you want to reopen some of those > tabs, you would navigate to that part of the bookmarks and open the tabs > you want. > > Maybe you have something else in mind? Do you want to send the links of > the opened tab set to someone else, but not all your bookmarks? Please > explain more carefully what you want to do. Ok, I can export bookmarks to html file and open it in Firefox to get a long list of clickable urls but icon of the bookmarked web page is missing. When I open Bookmarks as right a side-bar I can view and identify an individual Boomarks by icon, so I would like Firefox Library to export Bookmarks to html file, icons included ;) Since accessing opened Tabs is my default use of history in Firefox and has worked fine for years I paid no special interest to bookmark opened Tabs and assign labels to individual bookmark. So, generally speaking, I am happy with 1,000+ opened Tabs in Firefox , not being sure if this number is for real or refers to every bookmark from the history + opened Tabs But definitely I need a smarter solution and approach to manage 10,000+ opened Tabs in Firefox in a future ;) - I just build personal search engine resembling targets set by MyLifeBits Project by Microsoft in the past. darius -- https://mail.python.org/mailman/listinfo/python-list
Re: Numpy, Matplotlib crash Python 3.8 Windows 7, 32-bit - can you help ?
On Tuesday, 28 March 2023 at 18:12:40 UTC+2, Thomas Passin wrote: > On 3/28/2023 8:47 AM, a a wrote: > > Ok, I can export bookmarks to html file and open it in Firefox to get > > a long list of clickable urls but icon of the bookmarked web page is > > missing. > > > > When I open Bookmarks as right a side-bar I can view and identify an > > individual Boomarks by icon, > > so I would like Firefox Library to export Bookmarks to html file, icons > > included 😉 > > > > Since accessing opened Tabs is my default use of history in Firefox and has > > worked fine for years > > I paid no special interest to bookmark opened Tabs and assign labels to > > individual bookmark. > > > > So, generally speaking, I am happy with 1,000+ opened Tabs in Firefox , not > > being sure if this number is for real or refers to every bookmark from the > > history + opened Tabs > > > > But definitely I need a smarter solution and approach to manage 10,000+ > > opened Tabs in Firefox in a future 😉 > > I think you had better start using another name for this thread, if it > continues. > > The HTML export file will contain the icons, but the HTML elements do > not provide for showing them. > > I can't imagine how you can find anything among nor navigate through > 1000 open tabs, let alone 10,000 in the future. I would think the memory > usage would be impossibly high. So I hope you are mostly using the > history and do not really have that many tabs open at once! I am a plain guy, so if Firefox counted 1,000+ opened Tabs, I can be surprised, but have no idea how to check that number. You are exactly right, icon URI and icon data come with saved opened Tabs, a single example below. So I am going to ask Firefox team to offer export to html, modified to have : icon, name of web page, url address to appear in a single row (feature already supported by Firefox, when you open new Tab and click: enter URL or search string - input field, you get such list List is limited in size for the reasons unknown to me, but feature works fine. -- So would prefer a horizontal list of opened Tabs by htmlized, vertical list of the same opened Tabs, featuring: icon, name of web-site, URL address Thank you for your excellent support darius "https://www.nasa.gov/feature/goddard/2017/nasas-sdo-watches-a-sunspot-turn-toward-earth"; add_date="1499899506" last_modified="1499899507" icon_uri="https://www.nasa.gov/favicon.ico"; icon="data:image/png;base64,iVBORw0KGgoNSUhEUgAAADAwCAYAAABXAvmHAAAPkklEQVRoQ+1ZCVQUZ7b+qqo36AVommYXBARR45rnlpgEEZdoJokLmkWjyRjH5ZkzODEz5pk4mfdeEsf3krjEqHFiEk2c6KijJiqK2/h04r4EEQRBZFFkpxt6q6p3/8I2wDSIY86ZM+fMfw6H7q6//rrfXb97i8M/+eL+yeXHvwD8oy34wBaInf6ZrqbYFSlDTJQkOR4yFy5BDJRkqAQBdhlcJSdz1+lznhGGayUHplVzHCf/VMD/LgBLlsj8B8dWx4puaZQIjJZluS9JZKX/OiaYwHEwaAXUOTzNcnKcyMtcPcfjGs/hLypOtVtjMX9/e0u67UGAyEuW0HH3uUyjPk2QHI4ZJFq6JElxdDvf9gh2ql6jQoPzDgDaQOAIR/PjOPANHC8fU/PcmgCLNbNkS3rTfYoBedIkAZev9u80gNCRX+gbXLbnJFlcIElIIpF83qsReKgFDnanqPx3ky8F+KnQJViP7NI60Ne7i/DYeY7brtOq3q/JnP3D/YCQuySniQJiOgXAPHJVtMMpLxFl+Xmvm7R9GClYWcx1dGpynyY3IoP8UFzVCINOpXzOu9nQCoD3DJ7nc1Uq7j/GmEO2b9mSTl7Z8ZIjk4aLkH8haIU37wkgeMSqZLtLXiHJUmrLYyUmMROaTmA+HxGgQwP5fD39mf3VsLk8cIuyskXB1sKFfInHg69RqbAkxmL9JHtLusvXHlIeh5jkcZJHXAqe+0AoyVvbIQBjysdJHlFcT5p/xHsgE0ZFd0WRSxh0ajQ0unCrzgGrXg1/8vurlXaoVTxE5joEpNruYrJ3alGM2FQC/9a/Pd5jxeElKT8GEMM/ZIifVFL1MjzS2xR1h/hA7StcdratXQCWUWvCbQ73HyhQR7cU3o+Em/R4HIL0WpRVN0JLEcvTX3VtE07mVeKWzQmO/UY3qSkeXKKkVEuBfvO0DIB2IHEcX6cVuPn1h+Z+cfe5cT27SG7XIojydMoEV3gNP5krzM1tTgg+VsKY77RlTYXLSPvzWrkNCTCiTwQsgTpsO1ZIwslkSZCmNegZHYi4cCNyS+pw9lq1IuydpAMtAQk1aVFc07lkQzFxnVNrpzR6Zp5GQdKToiguJjM+TIq5wQv8DK44L8srl08AhpSV6W4R62VZMrQEQEkF04Z3w55TN8jf3aA0CL2fWnGZAgrQIL0Gw3qGwV+rwv7zpYr7UJZRjmBAO2EAMHsx6w11VRzaW7olXy2508kFA+j2Cl6tmssV525tKdPfAAh58rMwm82+Q5SlQW2Nw9zn+ZQEbD56DU0UpFYSmFKgklCLbjcq2zkK2b5dgzGgWzD2ny2j322Ki91rMcHZrliPDc/bcjCt7gfEuOvunIlbsqDOEG7kfN22iv/NyYbhH/+7y+35kCmt7UN15ApTUxPwzdFC1JIFmEWYVlmQet2F3UOUAnGhBqT1j8LRS+XIIbdqD4RX47GeBkywXcULDZfR3VlJD2+OfDq3GGpNBopytvmiIK0ARKZ+Hlztqd9NGWSwL40xRNNHdEPm2VLcqLLfray+9jIQLPc/PTgGhwnE5RYgmGhMcA0JmeSuVQSf0HAFia5q8LKERkEDjSyiQB2E/abEd+Zf2vR2exZsBcCYunqcy+X5hrK3X3tCTRgag1sUjH/JqVAyS0dLARHoh7GDu+DAuVIUVNjJrjxMkhsDnBWYaMvDaPs1RJOrMMHtvBZXtWa67kKxyoRFlmE4qwvbFd7VL71owwyHr2e1kkD/+KqP3JI4n21Ucvedq95NLLf3jTWTf1uwYX9ec2SyvS1ObguJEpVSM9L6ReLC8cvod+sqnrXnY5CjFEEelpVkOHg1zugicF4Xhn6Om8jRBOFd8yAUCQaWKG76qdUjaw7MutQhgLgRawLK3e49oiQNYfnbTyMoklEdgN0lKu7iTxTBSL+/ODIRn2Xm4XaDEyywWTbyFmaHRwSrQF7ftogO9Gssx4wwBwbH6mHdsxsaBwU8WaKeNP69XyS2m5Kh8bjwjP0qvjPEYZ2xF2ycyhsHkk4lzGhZF1oCuauwZsogZXkkKTwqyB/vzh6K+OggNNidWLzmBC4WVOGtaQ8jyKjD6ewy3Khuwp4zJXg0MQSLZgykdKpRqu+KLedw5EQB+ojVGGG/jlRUIHncEBgfHQiEhwEFlMGKSrFlxwV85Q5FiS4Ic1GAKdESqidORqZsxXufn0J5TePdGFMLwjL74bmvd2gBfcrKVI8HO2VI/ira+fmbaZg4
Re: How to add clickable url links to 3D Matplotlib chart ?
On Wednesday, 29 March 2023 at 22:51:15 UTC+2, Greg Ewing wrote: > On 30/03/23 8:39 am, a a wrote: > > How to add clickable url links to the following 3D Matplotlib chart to make > > it knowledge representation 3D chart, make of 1,000+ open Tabs in Firefox ? > It seems that matplotlib can be made to generate SVG images with > hyperlinks in them: > > https://matplotlib.org/stable/gallery/misc/hyperlinks_sgskip.html > > -- > Greg thank you but I need mouse hover-on, mouse click events to be handled by a simple algorithm to calculate which ball/circle has been selected (in the Matplotlib 3D animated chart above) to make the selected ball to flash and have label opened made of url icon, name of url, followed by url (exactly what Firefox makes with Tabs) For knowledge representation, 1,000+ Tabs open in Firefox, earthquakes 3D live chart by Giuseppe is a nice tool. One axis can represent time (timeline), two other axis can represent features attributed to to opened Tabs, like frequency of visits, ranking. Ok, balls should overlayed with a respective url icon, as done in Firefox (Tabs row) : url icon + label's name abbreviated -- https://mail.python.org/mailman/listinfo/python-list
Re: How to add clickable url links to 3D Matplotlib chart ?
On Thursday, 30 March 2023 at 07:55:13 UTC+2, Christian Gollwitzer wrote: > Am 30.03.23 um 01:11 schrieb a a: > > On Wednesday, 29 March 2023 at 22:51:15 UTC+2, Greg Ewing wrote: > >> On 30/03/23 8:39 am, a a wrote: > >>> How to add clickable url links to the following 3D Matplotlib chart to > >>> make it knowledge representation 3D chart, make of 1,000+ open Tabs in > >>> Firefox ? > >> It seems that matplotlib can be made to generate SVG images with > >> hyperlinks in them: > >> > >> https://matplotlib.org/stable/gallery/misc/hyperlinks_sgskip.html > >> > >> -- > >> Greg > > thank you > > but I need mouse hover-on, mouse click events to be handled by a simple > > algorithm to calculate which ball/circle has been selected (in the > > Matplotlib 3D animated chart above) to make the selected ball to flash and > > have label opened made of url icon, name of url, followed by url (exactly > > what Firefox makes with Tabs) > > > > For knowledge representation, 1,000+ Tabs open in Firefox, earthquakes 3D > > live chart by Giuseppe is a nice tool. > > > > One axis can represent time (timeline), two other axis can represent > > features attributed to to opened Tabs, like frequency of visits, ranking. > > > > Ok, balls should overlayed with a respective url icon, as done in Firefox > > (Tabs row) : url icon + label's name abbreviated > It doesn't sound as if there is a "one-line" solution to this problem. > It sounds more like you want a video game engine to interact with a 3D > world. > > There used to be a 3D version of HTML, called VRML, with the successor > of X3D that could show such a thing in the browser, but I doubt that > there is easy support for it any more in recent browsers. Therefore it > would be difficult to post this to the internet, unless you invest in > some JS programming. In case you want to run this on your local > computer, as opposed to in the browser, you can check out Python game > engines. > > Christian VRML is to heavy for me -- http://mpld3.github.io/examples/index.html#example-gallery Matplotlib charts can be integrated into web browser / Javascript mpld3 — Bringing Matplotlib to the Browser mpld3.github.io mpld3 project brings together Matplotlib, the popular Python-based graphing library, and D3js, the popular JavaScript library for creating interactive Javascript can track mouse position, mouse events, so I can calculate which ball/circle is selected to modify hue and generate active label assigned to the ball and have url link in the label opened by 2 mouse clicks. WebGL is nice but heavy for my project https://webglsamples.org/ https://en.wikipedia.org/wiki/WebGL All I need is Javascript to get access to database rendering geolocated balls, charted by Matplolib to update input data for a given ball and have Matplotlib chart to refresh on mouse click/ mouse hover - on To get 3D space I need to geolocate 1,000+Tabs open in Firefox Website geolocation I can read from domain register/s I need to project spherical Earth's globo to the place to get X - Y axis As a newbie to Python, I am looking for an experienced coder. -- https://mail.python.org/mailman/listinfo/python-list
Re: How to add clickable url links to 3D Matplotlib chart ?
On Thursday, 30 March 2023 at 13:14:33 UTC+2, a a wrote: > On Thursday, 30 March 2023 at 07:55:13 UTC+2, Christian Gollwitzer wrote: > > Am 30.03.23 um 01:11 schrieb a a: > > > On Wednesday, 29 March 2023 at 22:51:15 UTC+2, Greg Ewing wrote: > > >> On 30/03/23 8:39 am, a a wrote: > > >>> How to add clickable url links to the following 3D Matplotlib chart to > > >>> make it knowledge representation 3D chart, make of 1,000+ open Tabs in > > >>> Firefox ? > > >> It seems that matplotlib can be made to generate SVG images with > > >> hyperlinks in them: > > >> > > >> https://matplotlib.org/stable/gallery/misc/hyperlinks_sgskip.html > > >> > > >> -- > > >> Greg > > > thank you > > > but I need mouse hover-on, mouse click events to be handled by a simple > > > algorithm to calculate which ball/circle has been selected (in the > > > Matplotlib 3D animated chart above) to make the selected ball to flash > > > and have label opened made of url icon, name of url, followed by url > > > (exactly what Firefox makes with Tabs) > > > > > > For knowledge representation, 1,000+ Tabs open in Firefox, earthquakes 3D > > > live chart by Giuseppe is a nice tool. > > > > > > One axis can represent time (timeline), two other axis can represent > > > features attributed to to opened Tabs, like frequency of visits, ranking. > > > > > > Ok, balls should overlayed with a respective url icon, as done in Firefox > > > (Tabs row) : url icon + label's name abbreviated > > It doesn't sound as if there is a "one-line" solution to this problem. > > It sounds more like you want a video game engine to interact with a 3D > > world. > > > > There used to be a 3D version of HTML, called VRML, with the successor > > of X3D that could show such a thing in the browser, but I doubt that > > there is easy support for it any more in recent browsers. Therefore it > > would be difficult to post this to the internet, unless you invest in > > some JS programming. In case you want to run this on your local > > computer, as opposed to in the browser, you can check out Python game > > engines. > > > > Christian > VRML is to heavy for me > > -- > > > http://mpld3.github.io/examples/index.html#example-gallery > > Matplotlib charts can be integrated into web browser / Javascript > > mpld3 — Bringing Matplotlib to the Browser > mpld3.github.io > > mpld3 project brings together Matplotlib, the popular Python-based graphing > library, and D3js, the popular JavaScript library for creating interactive > > Javascript can track mouse position, mouse events, so I can calculate > which ball/circle is selected to modify hue and generate active label > assigned to the ball and have url link in the label opened by 2 mouse clicks. > > WebGL is nice but heavy for my project > https://webglsamples.org/ > > https://en.wikipedia.org/wiki/WebGL > > All I need is Javascript to get access to database rendering geolocated > balls, charted by Matplolib > to update input data for a given ball and have Matplotlib chart to refresh on > mouse click/ mouse hover - on > > To get 3D space I need to geolocate 1,000+Tabs open in Firefox > > Website geolocation I can read from domain register/s > > I need to project spherical Earth's globo to the place to get X - Y axis > > > As a newbie to Python, I am looking for an experienced coder. follow-up http://mpld3.github.io/examples/index.html#example-gallery I need to loop Matplotlib charts to get refreshed with new data inputs with mouse events (ball selection, selected ball new hue) Please keep in mind I need to open great Matplotlib charts by Giuseppe in web browser to serve as a knowledge representation and visualization for 1,000+ Tab open in Firefox https://twitter.com/gmrpetricca/status/1633477532526817281 -- https://mail.python.org/mailman/listinfo/python-list
Re: How to add clickable url links to 3D Matplotlib chart ?
On Thursday, 30 March 2023 at 13:19:51 UTC+2, a a wrote: > On Thursday, 30 March 2023 at 13:14:33 UTC+2, a a wrote: > > On Thursday, 30 March 2023 at 07:55:13 UTC+2, Christian Gollwitzer wrote: > > > Am 30.03.23 um 01:11 schrieb a a: > > > > On Wednesday, 29 March 2023 at 22:51:15 UTC+2, Greg Ewing wrote: > > > >> On 30/03/23 8:39 am, a a wrote: > > > >>> How to add clickable url links to the following 3D Matplotlib chart > > > >>> to make it knowledge representation 3D chart, make of 1,000+ open > > > >>> Tabs in Firefox ? > > > >> It seems that matplotlib can be made to generate SVG images with > > > >> hyperlinks in them: > > > >> > > > >> https://matplotlib.org/stable/gallery/misc/hyperlinks_sgskip.html > > > >> > > > >> -- > > > >> Greg > > > > thank you > > > > but I need mouse hover-on, mouse click events to be handled by a simple > > > > algorithm to calculate which ball/circle has been selected (in the > > > > Matplotlib 3D animated chart above) to make the selected ball to flash > > > > and have label opened made of url icon, name of url, followed by url > > > > (exactly what Firefox makes with Tabs) > > > > > > > > For knowledge representation, 1,000+ Tabs open in Firefox, earthquakes > > > > 3D live chart by Giuseppe is a nice tool. > > > > > > > > One axis can represent time (timeline), two other axis can represent > > > > features attributed to to opened Tabs, like frequency of visits, > > > > ranking. > > > > > > > > Ok, balls should overlayed with a respective url icon, as done in > > > > Firefox (Tabs row) : url icon + label's name abbreviated > > > It doesn't sound as if there is a "one-line" solution to this problem. > > > It sounds more like you want a video game engine to interact with a 3D > > > world. > > > > > > There used to be a 3D version of HTML, called VRML, with the successor > > > of X3D that could show such a thing in the browser, but I doubt that > > > there is easy support for it any more in recent browsers. Therefore it > > > would be difficult to post this to the internet, unless you invest in > > > some JS programming. In case you want to run this on your local > > > computer, as opposed to in the browser, you can check out Python game > > > engines. > > > > > > Christian > > VRML is to heavy for me > > > > -- > > > > > > http://mpld3.github.io/examples/index.html#example-gallery > > > > Matplotlib charts can be integrated into web browser / Javascript > > > > mpld3 — Bringing Matplotlib to the Browser > > mpld3.github.io > > > > mpld3 project brings together Matplotlib, the popular Python-based graphing > > library, and D3js, the popular JavaScript library for creating interactive > > > > Javascript can track mouse position, mouse events, so I can calculate > > which ball/circle is selected to modify hue and generate active label > > assigned to the ball and have url link in the label opened by 2 mouse > > clicks. > > > > WebGL is nice but heavy for my project > > https://webglsamples.org/ > > > > https://en.wikipedia.org/wiki/WebGL > > > > All I need is Javascript to get access to database rendering geolocated > > balls, charted by Matplolib > > to update input data for a given ball and have Matplotlib chart to refresh > > on mouse click/ mouse hover - on > > > > To get 3D space I need to geolocate 1,000+Tabs open in Firefox > > > > Website geolocation I can read from domain register/s > > > > I need to project spherical Earth's globo to the place to get X - Y axis > > > > > > As a newbie to Python, I am looking for an experienced coder. > follow-up > > http://mpld3.github.io/examples/index.html#example-gallery > > I need to loop Matplotlib charts to get refreshed with new data inputs with > mouse events > (ball selection, selected ball new hue) > > Please keep in mind I need to open great Matplotlib charts by Giuseppe in web > browser > to serve as a knowledge representation and visualization for 1,000+ Tab open > in Firefox > > https://twitter.com/gmrpetricca/status/1633477532526817281 2D Matplotlib solution for my project http://mpld3.github.io/examples/html_tooltips.html How to get it upgraded to 3D Matplotlib and get label to feature web link url assigned to a specified ball/ circle ? -- https://mail.python.org/mailman/listinfo/python-list
Python 2.4 decompiler
A brand new python 2.4 bytecode decompiler has been released. The compiling service is now available and includes features to check the correctness of the output. Those who need the service can contact us at [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Alessandra Ambrosio
Alessandra Ambrosio www.alphasearch.gr-- http://mail.python.org/mailman/listinfo/python-list
spam magnet
Hello, I hear (from google) that people get a lot of spam after posting to this list. That's nice, because I, [EMAIL PROTECTED] , happen to want a lot of spam :) Anyone who would like to send me their spam is welcome to as well (full headers please, I'm trying to track & corellate those wascally bots :)) SuperSpamCollector [EMAIL PROTECTED] :D -- http://mail.python.org/mailman/listinfo/python-list
Re: when the new version of XPN py2 newsreader src-tarball hits alt.binaries, the world will hold it's breath
py2 now, gotta fix that one -- https://mail.python.org/mailman/listinfo/python-list
Best way to construct an email - attach a html file and send
What is the best way to construct an email in python and also attach a html file the html file to be attached is not on disk, but should be dynamically constructed in the python script I want to attach the django debug error to an email and mail it to myself whenever there is an error in the application thanks a lot py -- http://mail.python.org/mailman/listinfo/python-list
Re: Best way to construct an email - attach a html file and send
where is the link thanks a lot for your kind help Larry Bates wrote: > a wrote: > > What is the best way to construct an email in python and also attach a > > html file > > > > the html file to be attached is not on disk, but should be dynamically > > constructed in the python script > > > > I want to attach the django debug error to an email and mail it to > > myself whenever there is an error in the application > > > > thanks a lot > > py > > > Here is a link to a class that will allow you to attach files. You > can either write the HTML to a tempfile and attach or modify a > little to accept a string or cstringIO object instead. Hope it > helps. > > -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list
keep a list of read and unread items
keep a list of read and unread items hi guys i m building an rss reader and i want you suggestions for datastructure for keeping read and unread list for each use i m assuming it will be very sparse thanks -- http://mail.python.org/mailman/listinfo/python-list
help parsing this
mx.DateTime.RangeError at /podcasts Failed to parse "31 Apr 2006 20:19:00 -0400": day out of range: 31 Python /usr/lib/python2.4/site-packages/mx/DateTime/Parser.py in DateTimeFromString, line 608 how to parse this date thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Best way to construct an email - attach a html file and send
hey larry thanks Larry Bates wrote: > a wrote: > > What is the best way to construct an email in python and also attach a > > html file > > > > the html file to be attached is not on disk, but should be dynamically > > constructed in the python script > > > > I want to attach the django debug error to an email and mail it to > > myself whenever there is an error in the application > > > > thanks a lot > > py > > > Here is a link to a class that will allow you to attach files. You > can either write the HTML to a tempfile and attach or modify a > little to accept a string or cstringIO object instead. Hope it > helps. > > -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list
any subway experiences
thanks for reading -- http://mail.python.org/mailman/listinfo/python-list
any subway web dev experiences
subway is pythons ruby on rails competitor pls tell me if u hav any expereinces thanks -- http://mail.python.org/mailman/listinfo/python-list
templating languages for webdev
cheetah vs django vs kid Any of you have experience using kid templates please let us know what you feel about it thanks sincerely jason -- http://mail.python.org/mailman/listinfo/python-list
psyco+webpy
hi i tried psyco+webpy
here is the error that i got
please let me know if any of you has success run psyco+webpy
thanks
import web, psyco
urls = (
'/', 'view',
'/add','add'
)
psyco.full()
psyco.log()
psyco.profile()
Launching server: http://0.0.0.0:8080/
Traceback (most recent call last):
File "C:\Python24\lib\site-packages\web.py", line 2054, in
run_wsgi_app
result = self.server.app(env, self.wsgi_start_response)
File "C:\Python24\lib\site-packages\web.py", line 1894, in wsgifunc
result = func()
File "C:\Python24\lib\site-packages\web.py", line 1872, in
func = lambda: handle(getattr(mod, name), mod)
File "C:\Python24\lib\site-packages\web.py", line 1051, in handle
return tocall(*([urllib.unquote(x) for x in args] + fna))
File "C:\mark\web1\codepsyco.py", line 27, in GET
web.render('view.html')
File "C:\Python24\lib\site-packages\web.py", line 1707, in render
terms.update(sys._getframe(1).f_locals)
File "C:\Python24\Lib\site-packages\psyco\support.py", line 129, in
__getattr_
_
raise AttributeError, ("local variables of functions run by Psyco "
AttributeError: local variables of functions run by Psyco cannot be
accessed in
any way, sorry
Traceback (most recent call last):
File "C:\Python24\lib\SocketServer.py", line 463, in
process_request_thread
self.finish_request(request, client_address)
File "C:\Python24\lib\SocketServer.py", line 254, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python24\lib\SocketServer.py", line 521, in __init__
self.handle()
File "C:\Python24\lib\BaseHTTPServer.py", line 316, in handle
self.handle_one_request()
File "C:\Python24\lib\BaseHTTPServer.py", line 310, in
handle_one_request
method()
File "C:\Python24\lib\site-packages\web.py", line 2090, in do_GET
self.run_wsgi_app()
File "C:\Python24\lib\site-packages\web.py", line 2072, in
run_wsgi_app
internalerror()
File "C:\Python24\lib\site-packages\web.py", line 1601, in debugerror
out = str(djangoerror())
File "C:\Python24\lib\site-packages\web.py", line 1587, in
djangoerror
return render(DJANGO_500_PAGE, asTemplate=True, isString=True)
File "C:\Python24\lib\site-packages\web.py", line 1707, in render
terms.update(sys._getframe(1).f_locals)
File "C:\Python24\Lib\site-packages\psyco\support.py", line 129, in
__getattr_
_
raise AttributeError, ("local variables of functions run by Psyco "
AttributeError: local variables of functions run by Psyco cannot be
accessed in
any way, sorry
--
http://mail.python.org/mailman/listinfo/python-list
Re: psyco+webpy
> psyco.cannotcompile(??.GET) this gives an error message
invalid syntax
Amaury Forgeot d'Arc wrote:
> a a écrit :
> > hi i tried psyco+webpy
> >
> > here is the error that i got
> > please let me know if any of you has success run psyco+webpy
> > thanks
> >
> > import web, psyco
> > urls = (
> > '/', 'view',
> > '/add','add'
> > )
> > psyco.full()
> > psyco.log()
> > psyco.profile()
> >
> > Launching server: http://0.0.0.0:8080/
> > Traceback (most recent call last):
> > File "C:\Python24\lib\site-packages\web.py", line 2054, in
> > run_wsgi_app
> > result = self.server.app(env, self.wsgi_start_response)
> > File "C:\Python24\lib\site-packages\web.py", line 1894, in wsgifunc
> > result = func()
> > File "C:\Python24\lib\site-packages\web.py", line 1872, in
> > func = lambda: handle(getattr(mod, name), mod)
> > File "C:\Python24\lib\site-packages\web.py", line 1051, in handle
> > return tocall(*([urllib.unquote(x) for x in args] + fna))
> > File "C:\mark\web1\codepsyco.py", line 27, in GET
> > web.render('view.html')
> > File "C:\Python24\lib\site-packages\web.py", line 1707, in render
> > terms.update(sys._getframe(1).f_locals)
> > File "C:\Python24\Lib\site-packages\psyco\support.py", line 129, in
> > __getattr__
>
> Functions optimized by Psyco have limitations concerning access of their
> local variables, as stated there:
> http://psyco.sourceforge.net/psycoguide/bugs.html
> As a workaround, you should prevent psyco from optimizing the functions
> calling render().
>
> psyco.cannotcompile(web.djangoerror)
> psyco.cannotcompile(??.GET)
>
> P.S. I just had a look at the web.py code and it seems that there are
> several uses of _getframe(x).f_locals. I find this trick not very
> pythonic (a function's docstring even says:"""Guido van Rossum doesn't
> want you to use this function.""") and anyway psyco will not appreciate it.
>
> --
> Amaury
--
http://mail.python.org/mailman/listinfo/python-list
global name is not defined - error
What I want --- I want to create a list of items from a function operating on an array of strings What I did - list=["s0","s1","s2"] l=len(list) for i in range(l): d_list[i]=f.do(list[i]) print d_list[i] Error: -- global name 'd_list' is not defined Python c:\test.py in newClass, line 30 Please help me out thanks -a -- http://mail.python.org/mailman/listinfo/python-list
how do i make an array global
def fn(): for i in range(l) global count count[i]= how do i declare count to be global if it is an array subsequently i should access or define count as an array error: global name 'count' is not defined thanks -a -- http://mail.python.org/mailman/listinfo/python-list
global name is not defined - error - but for array
def fn(): for i in range(l) global count count[i]= how do i declare count to be global if it is an array subsequently i should access or define count as an array error: global name 'count' is not defined thanks -a -- http://mail.python.org/mailman/listinfo/python-list
Re: global name is not defined - error
i changed it to append and it started working but once in a while i m getting l_code.append( len(d_list_code[i]['entries']) ) IndexError: list index out of range but it is not permanent if i refresh, it goes away! Marco Wahl wrote: > "a" <[EMAIL PROTECTED]> writes: > > > What I want > > --- > > I want to create a list of items from a function operating on an array > > of strings > > Ok. > > > What I did > > - > > list=["s0","s1","s2"] > > l=len(list) > > for i in range(l): > > d_list[i]=f.do(list[i]) > > print d_list[i] > > Aha! > > > Error: > > -- > > global name 'd_list' is not defined > > Pythonc:\test.py in newClass, line 30 > > Just as the error message tells: 'd_list' is not > defined which is an error. > > Try > > list=["s0","s1","s2"] > d_list = [] > l=len(list) > for i in range(l): > # d_list[i]=f.do(list[i]) > d_list.append(f.do(list[i])) > print d_list[i] > > This is just one suggestion there may be more elegant > ways. Have you heard about list comprehension? > > > HTH -- http://mail.python.org/mailman/listinfo/python-list
Re: how do i make an array global
hi bruno georg and erik you are right i m a newbie, i just want to do some stuff read out some stuff from a feed and display it in a page, so my py code, builds this list and when it goes to cheetah it gives me an error and hence i posted global has fixed the error but i keep getting this again and again and i dont know why? but if i refresh the page error goes away and the correct content comes up please help me out Traceback (most recent call last): File "C:\Python24\lib\site-packages\web.py", line 2054, in run_wsgi_app result = self.server.app(env, self.wsgi_start_response) File "C:\Python24\lib\site-packages\web.py", line 1894, in wsgifunc result = func() File "C:\Python24\lib\site-packages\web.py", line 1872, in func = lambda: handle(getattr(mod, name), mod) File "C:\Python24\lib\site-packages\web.py", line 1051, in handle return tocall(*([urllib.unquote(x) for x in args] + fna)) File "c:\mark\web1\code.py", line 64, in GET l_code.append( len(d_list_code[i]['entries']) ) IndexError: list index out of range it goes off when page is refreshed I m getting the following error, infrequently and if I refresh the page, it just displays the page properly I am unable to find the problem. How is this out of range and what does the error message mean? Solution: Remove all .pyc files from you Zope tree and try again: find -name "*.pyc" | xargs rm How can we do this when code is running? Traceback (most recent call last): File "C:\Python24\lib\site-packages\web.py", line 2054, in run_wsgi_app result = self.server.app(env, self.wsgi_start_response) File "C:\Python24\lib\site-packages\web.py", line 1894, in wsgifunc result = func() File "C:\Python24\lib\site-packages\web.py", line 1872, in func = lambda: handle(getattr(mod, name), mod) File "C:\Python24\lib\site-packages\web.py", line 1051, in handle return tocall(*([urllib.unquote(x) for x in args] + fna)) File "c:\usr\code.py", line 64, in GET l_code.append( len(d_list_code[i]['entries']) ) IndexError: list index out of range Erik Max Francis wrote: > Georg Brandl wrote: > > > No need for "global" here. > > Yes, that's true. I was just following the original poster's lead, but > I tend to use a `global` statement whenever I'm mutating a global in a > local block. That works as self-documentation and means you don't have > to be concerned about the precise case in which it's required, reducing > bugs when you change a block so that it would have been required if you > hadn't included it. > > -- > Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ > San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis >Seriousness is the only refuge of the shallow. > -- Oscar Wilde -- http://mail.python.org/mailman/listinfo/python-list
how do i use refreshCache with cheetah
how do i use refreshCache with cheetah -- http://mail.python.org/mailman/listinfo/python-list
Re: how do i make an array global
please tell me how to do it if i should not make it global like you guys worry i m not comfortable making it global and mutating it in every subblock thanks for reading and helping out -- http://mail.python.org/mailman/listinfo/python-list
cheetah - how do i use .refreshcaceh() in cheetah
cheetah - how do i use .refreshcaceh() in cheetah the doc is skimpy and doesnt tell more than you can use refreshcache with id to refresh a cache my code in html has #cache 30m, id =cachei #end cache -- http://mail.python.org/mailman/listinfo/python-list
what do you guys prefer for ajax?
what do you guys prefer for ajax? dojo mochikit prototype or somehting else/ -- http://mail.python.org/mailman/listinfo/python-list
list comprehension
can someone tell me how to use them thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: how do i make an array global
i understand index error but there is no index error in my code that is the problem! Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, a wrote: > > > Traceback (most recent call last): > > File "C:\Python24\lib\site-packages\web.py", line 2054, in > > run_wsgi_app > > result = self.server.app(env, self.wsgi_start_response) > > File "C:\Python24\lib\site-packages\web.py", line 1894, in wsgifunc > > result = func() > > File "C:\Python24\lib\site-packages\web.py", line 1872, in > > func = lambda: handle(getattr(mod, name), mod) > > File "C:\Python24\lib\site-packages\web.py", line 1051, in handle > > return tocall(*([urllib.unquote(x) for x in args] + fna)) > > File "c:\mark\web1\code.py", line 64, in GET > > l_code.append( len(d_list_code[i]['entries']) ) > > IndexError: list index out of range > > > > it goes off when page is refreshed > > > > I m getting the following error, infrequently and if I refresh the > > page, it just displays the page properly > > I am unable to find the problem. How is this out of range and what > > does the error message mean? > > The error message means that you try to access a list item that does not > exist:: > > In [1]: a = [1, 2, 3] > > In [2]: a[0] > Out[2]: 1 > > In [3]: a[1] > Out[3]: 2 > > In [4]: a[2] > Out[4]: 3 > > In [5]: a[3] > ----- > exceptions.IndexErrorTraceback (most recent call last) > > /home/marc/ > > IndexError: list index out of range > > So from the traceback it seems that `i` has a value that's not between 0 > and ``len(d_list_code)``. > > Ciao, > Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list
Re: list comprehension
hi simon thanks for your reply what if i want to do this feed_list=[] feed_id=[] for ix in feeds_list_select: global feeds_list global feeds_id feeds_list.append(ix.url) feeds_id.append(ix.id) ie not one variable but more variables thanks Simon Forman wrote: > a wrote: > > can someone tell me how to use them > > thanks > > basically, a list comprehension is just like a for loop, if you wrote > it out the "long way" it would be something like this: > > results = [] > for var in some_iterable: > if some condition: > results.append(some expression) > > > The list comprehension version: > > results = [some expression for var in some_iterable if some condition] > > > There's more to it, but that's the basic idea. > > Hope this helps, > ~Simon -- http://mail.python.org/mailman/listinfo/python-list
Re: list comprehension
if i remove the global i get an undefined error! it was suggested as a solution in this group below http://groups.google.com/group/comp.lang.python/browse_thread/thread/b7b2dcdc3e109f3e?hide_quotes=no#msg_8130543f82c6 thanks Simon Forman wrote: > a wrote: > > hi simon thanks for your reply > > You're most welcome > > > > what if i want to do this > > feed_list=[] > > feed_id=[] > > for ix in feeds_list_select: > > global feeds_list > > global feeds_id > > feeds_list.append(ix.url) > >feeds_id.append(ix.id) > > > > ie not one variable but more variables > > thanks > > in a case like this I would usually reach for the zip() function, with > the "varargs" * calling pattern > > N = [(ix.url, ix.id) for ix in feeds_list_select] > > feed_list, feed_id = zip(*N) > > > or just > > feed_list, feed_id = zip(*[(ix.url, ix.id) for ix in > feeds_list_select]) > > > btw, please note that the global statements in your example are > unnecessary.. *totally* unnecessary. :-D -- http://mail.python.org/mailman/listinfo/python-list
Re: list comprehension
hey guys this is gr8 but in cheetah i use for test in $ix $test.url end for to iterate thru loop now how do i iterate feed_list and feed_id along with i, thanks a lot N = [(ix.url, ix.id) for ix in feeds_list_select] feed_list, feed_id = zip(*N) or just feed_list, feed_id = zip(*[(ix.url, ix.id) for ix in feeds_list_select]) Simon Forman wrote: > a wrote: > > hi simon thanks for your reply > > You're most welcome > > > > what if i want to do this > > feed_list=[] > > feed_id=[] > > for ix in feeds_list_select: > > global feeds_list > > global feeds_id > > feeds_list.append(ix.url) > >feeds_id.append(ix.id) > > > > ie not one variable but more variables > > thanks > > in a case like this I would usually reach for the zip() function, with > the "varargs" * calling pattern > > N = [(ix.url, ix.id) for ix in feeds_list_select] > > feed_list, feed_id = zip(*N) > > > or just > > feed_list, feed_id = zip(*[(ix.url, ix.id) for ix in > feeds_list_select]) > > > btw, please note that the global statements in your example are > unnecessary.. *totally* unnecessary. :-D -- http://mail.python.org/mailman/listinfo/python-list
Python plugin for Netbeans
Netbeans added a python plugin to its plugin repository. Do you tried it? What do you think about this plugin? -- http://mail.python.org/mailman/listinfo/python-list
python gui
where's the best online resource for teaching about GUI building? Thanks Paul C -- http://mail.python.org/mailman/listinfo/python-list
indexing lists/arrays question
this must be easy but its taken me a couple of hours already i have a=[2,3,3,4,5,6] i want to know the indices where a==3 (ie 1 and 2) then i want to reference these in a ie what i would do in IDL is b=where(a eq 3) a1=a(b) any ideas? Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: indexing lists/arrays question
On 13 May, 15:47, Stefan Behnel wrote: > a, 13.05.2010 16:36: > > > this must be easy but its taken me a couple of hours already > > > i have > > > a=[2,3,3,4,5,6] > > > i want to know the indices where a==3 (ie 1 and 2) > > indices = [ i for i,item in enumerate(a) if item == 3 ] > > > then i want to reference these in a > > print [ a[i] for i in indices ] > > Stefan thanks Stefan. very useful. I didn't get this from the python documentation! -- http://mail.python.org/mailman/listinfo/python-list
Re: indexing lists/arrays question
On 13 May, 16:19, Tim Chase wrote: > On 05/13/2010 09:36 AM, a wrote: > > > this must be easy but its taken me a couple of hours already > > > i have > > > a=[2,3,3,4,5,6] > > > i want to know the indices where a==3 (ie 1 and 2) > > indexes = [i for (i, v) in enumerate(a) where v==3] > > > then i want to reference these in a > > In a _what_? You can then do things like > > for i in indexes: > print a[i] > > (but you already know these are "3", so it's not very exciting...) > > -tkc really its to get the indexes in 1 array where something equals something then reference these in another array. -- http://mail.python.org/mailman/listinfo/python-list
Re: indexing lists/arrays question
On 13 May, 17:41, Carey Tilden wrote: > On Thu, May 13, 2010 at 8:45 AM, a > wrote: > > On 13 May, 16:19, Tim Chase wrote: > >> On 05/13/2010 09:36 AM, a wrote: > > >> > this must be easy but its taken me a couple of hours already > > >> > i have > > >> > a=[2,3,3,4,5,6] > > >> > i want to know the indices where a==3 (ie 1 and 2) > > >> indexes = [i for (i, v) in enumerate(a) where v==3] > > >> > then i want to reference these in a > > >> In a _what_? You can then do things like > > >> for i in indexes: > >> print a[i] > > >> (but you already know these are "3", so it's not very exciting...) > > >> -tkc > > > really its to get the indexes in 1 array where something equals > > something then reference these in another array. > > -- > >http://mail.python.org/mailman/listinfo/python-list > > Out of curiosity, why are you using two arrays? Have you considered a > dict? There are of course good reasons not to use a dict in this > situation, but you haven't said one way or another. > > Carey i am reading a 2,n array from one website, column1=times, column2=values then another 2,n array from another website, column1=times, column2=values the times are different but may (or may not) coincide in places i need to make a 3rd array, 2,n where the first column are column2 values from array1 and the second column are column2 values from array 2 #where the timestamps agree# i'm an idl programmer and doing this would be second nature but i need to make an application which does something along the lines of the above then plots column2 vs column2 for the above array3 (plus some other maths). needs to be non-proprietary and work on different platforms. i just started with python, not even sure if it's the best thing. the plotting routines seem not to come wrapped with standard python which is a bit of a pain. the routine i use most in idl is 'where' and though i managed to write a def which worked, i couldn't then dereference the list of those indexes. i'm a bit old to be learning new languages thanks for your help! -- http://mail.python.org/mailman/listinfo/python-list
Re: indexing lists/arrays question
On 13 May, 18:18, Tim Chase wrote: > On 05/13/2010 10:45 AM, a wrote: > > > > > > >>> a=[2,3,3,4,5,6] > > >>> i want to know the indices where a==3 (ie 1 and 2) > > >> indexes = [i for (i, v) in enumerate(a) where v==3] > > >>> then i want to reference these in a > > >> In a _what_? You can then do things like > > >> for i in indexes: > >> print a[i] > > >> (but you already know these are "3", so it's not very exciting...) > > >> -tkc > > > really its to get the indexes in 1 array where something equals > > something then reference these in another array. > > If your two arrays are of the same length, you can do things like > > a = [2,3,3,4,5,6] > b = ['a', 'b', 'c', 'd', 'e', 'f'] > > print [m for (n,m) in zip(a,b) if n == 3] > > and skip the indexes altogether. > > -tkc mmm, that's clever, thanks. although i don't know why it works yet. at least i found a good user group! -- http://mail.python.org/mailman/listinfo/python-list
stopping execution window on error - newbie
I'm coding on an old windows laptop i write the code and double click the icon. it runs the program and writes results to a window. when the code finishes, the window closes, i do a time.sleep(10) to see what has happened. unfortunately when there is an error it just closes the window. anyway of seeing the error messages? thanks a -- http://mail.python.org/mailman/listinfo/python-list
Re: stopping execution window on error - newbie
On 14 May, 00:14, Mensanator wrote:
> On May 13, 4:00 pm, a wrote:
>
> > I'm coding on an old windows laptop
>
> > i write the code and double click the icon.
>
> Don't do that.
>
> > it runs the program and
> > writes results to a window.
>
> > when the code finishes, the window closes, i do a time.sleep(10) to
> > see what has happened.
>
> > unfortunately when there is an error it just closes the window.
> > anyway of seeing the error messages?
>
> Go to the windows [Start] button. Select [Run...] and in the popup
> box,
> type "cmd" as the program to run. This will open a DOS shell window (a
> text window.)
>
> Then you can run your Python script from the window prompt and it
> won't
> close until you manually close it, even if the program crashes.
>
> For example, once I open the DOS shell...
>
>
> Microsoft Windows XP [Version 5.1.2600]
> (C) Copyright 1985-2001 Microsoft Corp.
>
> H:\>C:
>
> C:\>cd python31\user\lotto
>
> C:\Python31\user\lotto>dir
> Volume in drive C has no label.
> Volume Serial Number is 06DE-55B4
>
> Directory of C:\Python31\user\lotto
>
> 05/13/2010 05:53 PM .
> 05/13/2010 05:53 PM ..
> 08/19/2009 07:08 PM 3,334 lotto.py
> 05/13/2010 05:56 PM 6,068 lotto_2010.py
> 2 File(s) 9,402 bytes
> 2 Dir(s) 102,247,440,384 bytes free
>
> C:\Python31\user\lotto>..\..\python lotto_2010.py
>
> {1: 2, 2: 3, 3: 2, 4: 1, 5: 2, 6: 1, 7: 2, 8: 1, 9: 1, 10: 2, 11: 2,
> 13: 1, 14: 2, 17: 1, 18: 2, 19: 1, 20: 1, 21: 1, 22: 1, 24: 1, 25: 1,
> 26: 3, 27: 1, 28: 2, 29: 2, 30: 1, 31: 1, 32: 1, 34: 1, 35: 1, 37: 2,
> 38: 2, 39: 2, 40: 1, 42: 2, 43: 1, 44: 2, 46: 2, 47: 1, 48: 1, 50: 1,
> 51: 2, 52: 3}
>
> 1 2 **
> 2 3 ***
> 3 2 **
> 4 1 *
> 5 2 **
> 6 1 *
> 7 2 **
> 8 1 *
> 9 1 *
> 10 2 **
> 11 2 **
> 12
> 13 1 *
> 14 2 **
> 15
> 16
> 17 1 *
> 18 2 **
> 19 1 *
> 20 1 *
> 21 1 *
> 22 1 *
> 23
> 24 1 *
> 25 1 *
> 26 3 ***
> 27 1 *
> 28 2 **
> 29 2 **
> 30 1 *
> 31 1 *
> 32 1 *
> 33
> 34 1 *
> 35 1 *
> 36
> 37 2 **
> 38 2 **
> 39 2 **
> 40 1 *
> 41
> 42 2 **
> 43 1 *
> 44 2 **
> 45
> 46 2 **
> 47 1 *
> 48 1 *
> 49
> 50 1 *
> 51 2 **
> 52 3 ***
>
> (7, 21, 50, 36, 26, 3)
> (7, 21, 50, 36, 26, 17)
> (7, 21, 50, 36, 26, 52)
> (7, 21, 50, 36, 3, 17)
> (7, 21, 50, 36, 3, 52)
> (7, 21, 50, 36, 17, 52)
> (7, 21, 50, 26, 3, 17)
> (7, 21, 50, 26, 3, 52)
> (7, 21, 50, 26, 17, 52)
> (7, 21, 50, 3, 17, 52)
> (7, 21, 36, 26, 3, 17)
> (7, 21, 36, 26, 3, 52)
> (7, 21, 36, 26, 17, 52)
> (7, 21, 36, 3, 17, 52)
> (7, 21, 26, 3, 17, 52)
> (7, 50, 36, 26, 3, 17)
> (7, 50, 36, 26, 3, 52)
> (7, 50, 36, 26, 17, 52)
> (7, 50, 36, 3, 17, 52)
> (7, 50, 26, 3, 17, 52)
> (7, 36, 26, 3, 17, 52)
> (21, 50, 36, 26, 3, 17)
> (21, 50, 36, 26, 3, 52)
> (21, 50, 36, 26, 17, 52)
> (21, 50, 36, 3, 17, 52)
> (21, 50, 26, 3, 17, 52)
> (21, 36, 26, 3, 17, 52)
> (50, 36, 26, 3, 17, 52)
>
> 8 9 32 38 40 48
> 13 22 28 39 42 43
> 1 2 5 11 18 52 +
> 2 3 26 44 51 52 +++
> 4 7 14 26 35 52 +++
> 2 7 10 19 42 47 +
> 5 20 31 34 50 51 +
> 1 28 29 37 39 46
> 10 11 27 37 38 46
> 6 21 24 29 30 44 +
> 3 14 17 18 25 26 +++
> 7 10 39 42 45 46 +
> 15 17 23 36 38 44 ++
> 16 19 23 27 41 49
> 15 25 32 36 44 47 +
> 16 19 24 29 38 41
> 3 4 8 13 43 49 +
> 2 11 17 19 22 50 ++
> 14 21 22 28 30 45 +
> 4 15 21 34 47 49 +
> 19 34 38 39 40 48
> 4 16 24 33 37 48
> 8 16 17 18 39 40 +
> 1 24 27 30 31 47
> 1 7 11 21 30 43 ++
> 1 8 13 18 32 36 +
> 5 10 12 16 20 21 +
> 7 11 23 24 26 35 ++
> 7 8 11 13 42 49 +
> 1 8 17 34 40 50 ++
> 1 24 29 35 41 45
> 15 17 24 32 44 52 ++
> 4 12 21 26 33 38 ++
> 2 13 15 41 48 50 +
> 2 7 9 27 45 52 ++
> 24 25 35 36 39 42 +
> 8 22 39 40 42 48
> 16 18 29 30 34 43
> 7 21 28 36 45 50
> 4 8 30 35 39 42
> 2 11 15 23 40 51
> 2 7 14 18 23 34 +
> 1 11 22 37 41 50 +
> 4 34 40 44 50 52 ++
> 12 28 33 39 40 52 +
> 14 18 25 36 38 39 +
> 4 11 16 17 27 37 +
> 1 11 16 28 31 36 +
> 8 16 31 34 36 52 ++
> 7 10 15 21 35 36 +++
> 2 9 21 23 29 30 +
> 15 29 33 41 46 47
> 2 5 18 34 36 39 +
> 7 15 21 31 45 50 +++
> 12 17 20 28 39 51 +
> 3 7 22 26 50 52 +
> 1 5 21 27 31 39 +
> 2 8 10 23 34 50 +
> 1 11 24 26 32 52 ++
> 1 18 20 38 41 42
> 12 33 36 42 45 48 +
> 1 6 21 28 37 39 +
> 16 18 19 22 33 35
python application question
I am trying to write an application that takes two files from over the internet and plots one against the other i am getting the data ok. if i want to plot it i have to use something like matplotlib? but this doesn't come with the standard installation. so if i want someone else to use this application, do they have to install matplotlib themselves or is there a better way? ps someone helped me with enumerate(), which works on the linux but not on the windows? thanks -- http://mail.python.org/mailman/listinfo/python-list
problem in event handling on change of variable value.
Hi, I want know how can I control Canoe tool from Python. I want to use Python as the mediator for linking CANoe and Matlab. Please give me some inputs regarding this. Thanks & Regards Nadhiya.A Larsen & Toubro Limited www.larsentoubro.com This Email may contain confidential or privileged information for the intended recipient (s). If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system. Earth Day. Every Day. -- http://mail.python.org/mailman/listinfo/python-list
Re: Unit testing beginner question
That was quick! Thanks Ian On 23 May 2011 23:46, Ian Kelly wrote: > On Mon, May 23, 2011 at 4:30 PM, Andrius wrote: > > and I am expecting test to pass, but I am getting exception: > > Traceback (most recent call last): > >self.assertRaises(TypeError, self.testListNone[:1]) > > TypeError: 'NoneType' object is unsubscriptable > > > > I thought that assertRaises will pass since TypeError exception will > > be raised? > > The second argument to assertRaises must be a function that > assertRaises will call. assertRaises can't catch the error above > because it is raised when the argument is evaluated, before > assertRaises has even been called. > > This would work: > > self.assertRaises(TypeError, lambda: self.testListNone[:1]) > > Cheers, > Ian > -- http://mail.python.org/mailman/listinfo/python-list
getting rid of the recursion in __getattribute__
It is perfectly explained in the standards here [1] saying that:
In order to avoid infinite recursion in this method, its implementation should
always call the base class method with the same name to access any attributes
it needs, for example, object.__getattribute__(self, name).
Therefore, I wrote a code following what the standard says:
class Sample():
def __init__(self):
self.a = -10
def __getattribute__(self, name):
if name == 'a':
return object.__getattribute__(self, name)
raise AttributeError()
s = Sample()
result = s.a
print(result)
I did not fall into recursion, and the output was
-10
I used here object.__getattribute__(self, name) cause the base class of Sample
is object.
If I derive the Sample class from another class such as A, I should change
object.__getattribute__(self, name) to A.__getattribute__(self, name) as the
base class of class Sample is class A.
class A:
pass
class Sample(A):
def __init__(self):
self.a = -10
def __getattribute__(self, name):
if name == 'a':
return A.__getattribute__(self, name)
raise AttributeError()
s = Sample()
result = s.a
print(result)
which gives the same output as expected. No recursion and -10.
However, when I try the code without deriving from a class:
class AnyClassNoRelation:
pass
class Sample():
def __init__(self):
self.a = -10
def __getattribute__(self, name):
if name == 'a':
return AnyClassNoRelation.__getattribute__(self, name)
raise AttributeError()
s = Sample()
result = s.a
print(result)
and calling __getattribute__ via any class (in this example class
AnyClassNoRelation) instead of object.__getattribute__(self, name) as the
standard says call using the base class, I get the same output: no recursion
and -10.
So my question:
How come this is possible (having the same output without using the base
class's __getattribute__? Although the standards clearly states that
__getattribute__ should be called from the base class.
In order to avoid infinite recursion in this method, its implementation should
always call the base class method with the same name to access any attributes
it needs, for example, object.__getattribute__(self, name).
Literally, I can call __getattribute__ with anyclass (except Sample cause it
will be infinite recursion) I define and it works just fine. Could you explain
me why that happens?
[1] https://docs.python.org/3/reference/datamodel.html#object.__getattribute__
--
https://mail.python.org/mailman/listinfo/python-list
Help is needed!
Hi,
I am trying to do the following :
I am trying to show the changes in the command line in real time in my
Tkinter GUI, I managed to create the GUI and integrate the terminal into
it, but I cant bind the buttons with the terminal, my code is :
import Tkinterfrom Tkinter import *import subprocessimport osfrom os
import system as cmd
WINDOW_SIZE = "600x400"
top = Tkinter.Tk()
top.geometry(WINDOW_SIZE)
def helloCallBack():
print "Below is the output from the shell script in terminal"
subprocess.call('perl
/projects/tfs/users/$USER/scripts_coverage.pl', shell=True)def
BasicCovTests():
print "Below is the output from the shell script in terminal"
subprocess.call('perl
/projects/tfs/users/$USER/basic_coverage_tests.pl', shell=True)def
FullCovTests():
print "Below is the output from the shell script in terminal"
subprocess.call('perl
/projects/tfs/users/$USER/basic_coverage_tests.pl', shell=True)
Scripts_coverage = Tkinter.Button(top, text ="Scripts Coverage",
command = helloCallBack)Scripts_coverage.pack()
Basic_coverage_tests = Tkinter.Button(top, text ="Basic Coverage
Tests", command = BasicCovTests)Basic_coverage_tests.pack()
Full_coverage_tests = Tkinter.Button(top, text ="Full Coverage
Tests", command = FullCovTests)Full_coverage_tests.pack()
termf = Frame(top, height=100, width=500)
termf.pack(fill=BOTH, expand=YES)
wid = termf.winfo_id()
os.system('xterm -into %d -geometry 100x20 -sb &' % wid)
def send_entry_to_terminal(*args):
"""*args needed since callback may be called from no arg (button)
or one arg (entry)
"""
cmd("%s" % (BasicCovTests))
top.mainloop()
I want win I click the button to see it printing the command in the
terminal[image: enter image description here]
How do I do that ???
Please advice
--
https://mail.python.org/mailman/listinfo/python-list
writing to command line thru python gui
I posted this question, no reply : Any advice : http://unix.stackexchange.com/questions/273573/write-to-terminal-in-tkinter-gui -- https://mail.python.org/mailman/listinfo/python-list
How to only read words within brackets/ parentheses (in .txt file) using Python
I understand that reading lines in .txt files would look something like this in
Python:
with open('filename','r') as fd:
lines = fd.readlines()
However, how do I run my code to only read the words in my .txt files that are
within each balanced parenthesis?
I am not sure how to go about it, let's say my .txt file contents lines like
this:
k;
select xx("xE'", PUT(xx..),"'") jdfjhf:jhfjj from _x_xx_L ;
quit;
/* 1.x FROM _x_Ex_x */
proc sql; "TRUuuuth");
hhhjhfjs as fdsjfsj:
select * from djfkjd to jfkjs
(SELECT abc AS abc1, abc_2_ AS efg, abc_fg, fkdkfj_vv, jjsflkl_ff, fjkdsf_jfkj
FROM &xxx..xxx_xxx_xxE
where (xxx(xx_ix as format '-xx') gff &jfjfsj_jfjfj.) and
(xxx(xx_ix as format '-xx') lec &jgjsd_vnv.)
);
The main idea is to read only these portions of the .txt file (i.e. Those
within parentheses):
("xE'", PUT(xx..),"'") jdfjhf:jhfjj from _x_xx_L ;
quit;
/* 1.x FROM _x_Ex_x */
proc sql; "TRUuuuth")
(SELECT abc AS abc1, abc_2_ AS efg, abc_fg, fkdkfj_vv, jjsflkl_ff, fjkdsf_jfkj
FROM &xxx..xxx_xxx_xxE
where (xxx(xx_ix as format '-xx') gff &jfjfsj_jfjfj.) and
(xxx(xx_ix as format '-xx') lec &jgjsd_vnv.)
)
Any help will be truly appreciated
--
https://mail.python.org/mailman/listinfo/python-list
Finding lines in .txt file that contain keywords from two different set()
My problem is seemingly profound but I hope to make it sound as simplified as
possible.Let me unpack the details..:
1. I have one folder of Excel (.xlsx) files that serve as a data dictionary.
-In Cell A1, the data source name is written in between brackets
-In Cols C:D, it contains the data field names (It could be in either col C or
D in my actual Excel sheet. So I had to search both columns
-*Important: I need to know which data source the field names come from
2. I have another folder of Text (.txt) files that I need to parse through to
find these keywords.
These are the folders used for a better reference (
https://drive.google.com/open?id=1_LcceqcDhHnWW3Nrnwf5RkXPcnDfesq ). The files
are found in the folder.
This is the code I have thus far...:
import os, sys
from os.path
import join
import re
import xlrd
from xlrd import open_workbook
import openpyxl
from openpyxl.reader.excel import load_workbook
import xlsxwriter
#All the paths
dict_folder = 'C:/Users//Documents//Test Excel'
text_folder = 'C:/Users//Documents//Text'
words = set()
fieldset = set()
for file in os.listdir(dict_folder):
if file.endswith(".xlsx"):
wb1 = load_workbook(join(dict_folder, file), data_only = True)
ws = wb1.active
#Here I am reading and printing all the data source names set(words) in the
excel dictionaries:
cellvalues = ws["A1"].value
wordsextract = re.findall(r"\((.+?)\)", str(cellvalues))
results = wordsextract[0]
words.add(results)
print(results)
for rowofcellobj in ws["C" : "D"]:
for cellobj in rowofcellobj:
#2. Here I am printing all the field names in col C & D in the excel
dictionaries:
data = re.findall(r"\w+_.*?\w+", str(cellobj.value))
if data != []:
fields = data[0]
fieldset.add(fields)
print(fieldset)
#listing = str.remove("")
#print(listing)
#Here I am reading the name of each .txt file to the separate .xlsx file:
for r, name in enumerate(os.listdir(text_folder)):
if name.endswith(".txt"):
print(name)
#Reading .txt file and trying to make the sentence into words instead of lines
so that I can compare the individual .txt file words with the .xlsx file
txtfilespath = os.chdir("C:/Users//Documents//Text")
#Here I am reading and printing all the words in the .txt files and compare
with the excel Cell A1:
for name in os.listdir(txtfilespath):
if name.endswith(".txt"):
with open (name, "r") as texts:
# Read each line of the file:
s = texts.read()
print(s)
#if .txt files contain.() or select or from or words from
sets..search that sentence and extract the common fields
result1 = []
parens = 0
buff = ""
for line in s:
if line == "(":
parens += 1
if parens > 0:
buff += line
if line == ")":
parens -= 1
if not parens and buff:
result1.append(buff)
buff = ""
set(result1)
#Here, I include other keywords other than those found in the Excel workbooks
checkhere = set()
checkhere.add("Select")
checkhere.add("From")
checkhere.add("select")
checkhere.add("from")
checkhere.add("SELECT")
checkhere.add("FROM")
# k = list(checkhere)
# print(k)
#I only want to read/ extract the lines containing brackets () as well as
the keywords in the checkhere set. So that I can check capture the source and
field in each line:
#I tried this but nothing was printed..
for element in checkhere:
if element in result1:
print(result1)
My desired output for the code that could not be printed when I tried is:
(/* 1.select_no., bi FROM apple_x_Ex_x */
proc sql; "TRUuuuth")
(/* 1.x FROM x*/
proc sql; "TRUuuuth")
(SELECT abc AS abc1, ab33_2_ AS mon, a_rr, iirir_vf, jk_ff, sfa_jfkj
FROM &orange..xxx_xxx_xxE
where (asre(kkk_ix as format '-xx') gff &bcbcb_hhaha.) and
(axx(xx_ix as format '-xx') lec &jgjsd_vnv.)
)
(/* 1.select_no. FROM apple_x_Ex_x */
proc sql; "TRUuuuth")
(SELECT abc AS kf, mcfg_2_ AS dokn, b_rr, jjhj_vf, jjjk_hj, fjjh_jhjkj
FROM &bfbd..pear_xxx_xxE
where (afdfe(kkffk_ix as format 'd-xx') gdaff &bcdadabcb_hdahaha.) and
(axx(xx_ix as format '-xx') lec &jgjsdfdf_vnv.)
)
After which, if I'm able to get the desired output above, I will then compare
these lines against the word set() and the fieldset set().
Any help would really be appreciated here..thank you
--
https://mail.python.org/mailman/listinfo/python-list
Extract sentences in nested parentheses using Python
I am trying to extract all strings in nested parentheses (along with the
parentheses itself) in my .txt file. Please see the sample .txt file that I
have used in this example here:
(https://drive.google.com/open?id=1UKc0ZgY9Fsz5O1rSeBCLqt5dwZkMaQgr).
I have tried and done up three different codes but none of them seems to be
able to extract all the nested parentheses. They can only extract a portion of
the nested parentheses. Any advice on what I've done wrong could really help!
Here are the three codes I have done so far:
1st attempt:
import re
from os.path import join
def balanced_braces(args):
parts = []
for arg in args:
if '(' not in arg:
continue
chars = []
n = 0
for c in arg:
if c == '(':
if n > 0:
chars.append(c)
n += 1
elif c == ')':
n -= 1
if n > 0:
chars.append(c)
elif n == 0:
parts.append(''.join(chars).lstrip().rstrip())
chars = []
elif n > 0:
chars.append(c)
return parts
with open('lan sample text file.txt','r') as fd:
#for words in fd.readlines():
t1 = balanced_braces(fd);
print(t1)
Output:
['"xE\'", PUT(xx..),"\'"', '"TRUuuuth"', "xxx(xx_ix as format '-xx')
lec &jgjsd_vnv.", '"xE\'", PUT(xx..),"\'"', '"CUuuuth"', "xxx(xx_ix as
format '-xx') lec &jgjsd_vnv."]
2nd attempt:
from pyparsing import nestedExpr
matchedParens = nestedExpr('(',')')
with open('lan sample text file.txt','r') as fd:
for words in fd.readlines():
for e in matchedParens.searchString(words):
print(e)
Output:
[['"xE\'"', ',', 'PUT', ['xx..'], ',', '"\'"']]
[['"TRUuuuth"']]
[['xxx', ['xx_ix', 'as', 'format', "'-xx'"], 'gff', '&jfjfsj_jfjfj.']]
[['xxx', ['xx_ix', 'as', 'format', "'-xx'"], 'lec', '&jgjsd_vnv.']]
[['"xE\'"', ',', 'PUT', ['xx..'], ',', '"\'"']]
[['"CUuuuth"']]
[['xxx', ['xx_ix', 'as', 'format', "'-xx'"], 'gff', '&jfjfsj_jfjfj.']]
[['xxx', ['xx_ix', 'as', 'format', "'-xx'"], 'lec', '&jgjsd_vnv.']]
3rd attempt:
def parse_segments(source, recurse=False):
unmatched_count = 0
start_pos = 0
opened = False
open_pos = 0
cur_pos = 0
finished = []
segments = []
for character in source:
#scan for mismatched parenthesis:
if character == '(':
unmatched_count += 1
if not opened:
open_pos = cur_pos
opened = True
if character == ')':
unmatched_count -= 1
if opened and unmatched_count == 0:
segment = source[open_pos:cur_pos+1]
segments.append(segment)
clean = source[start_pos:open_pos]
if clean:
finished.append(clean)
opened = False
start_pos = cur_pos+1
cur_pos += 1
# assert unmatched_count == 0
if start_pos != cur_pos:
#get anything that was left over here
finished.append(source[start_pos:cur_pos])
#now check on recursion:
for item in segments:
#get rid of bounding parentheses:
pruned = item[1:-1]
if recurse:
results = parse_tags(pruned, recurse)
finished.expand(results)
else:
finished.append(pruned)
return finished
with open('lan sample text file.txt','r') as fd:
for words in fd.readlines():
t = parse_segments(words)
print(t)
Output:
['k;\n']
['\n']
[' select xx', ' jdfjhf:jhfjj from _x_xx_L ;\n', '"xE\'",
PUT(xx..),"\'"']
['quit; \n']
['\n']
['/* 1.x FROM _x_Ex_x */ \n']
['proc sql; ', ';\n', '"TRUuuuth"']
['hhhjhfjs as fdsjfsj:\n']
['select * from djfkjd to jfkjs\n']
['(\n']
['SELECT abc AS abc1, abc_2_ AS efg, abc_fg, fkdkfj_
Re: Extract sentences in nested parentheses using Python
On Tuesday, 3 December 2019 01:01:25 UTC+8, Peter Otten wrote:
> A S wrote:
>
> I think I've seen this question before ;)
>
> > I am trying to extract all strings in nested parentheses (along with the
> > parentheses itself) in my .txt file. Please see the sample .txt file that
> > I have used in this example here:
> > (https://drive.google.com/open?id=1UKc0ZgY9Fsz5O1rSeBCLqt5dwZkMaQgr).
> >
> > I have tried and done up three different codes but none of them seems to
> > be able to extract all the nested parentheses. They can only extract a
> > portion of the nested parentheses. Any advice on what I've done wrong
> > could really help!
> >
> > Here are the three codes I have done so far:
> >
> > 1st attempt:
> >
> > import re
> > from os.path import join
> >
> > def balanced_braces(args):
> > parts = []
> > for arg in args:
> > if '(' not in arg:
> > continue
>
> There could still be a ")" that you miss
>
> > chars = []
> > n = 0
> > for c in arg:
> > if c == '(':
> > if n > 0:
> > chars.append(c)
> > n += 1
> > elif c == ')':
> > n -= 1
> > if n > 0:
> > chars.append(c)
> > elif n == 0:
> > parts.append(''.join(chars).lstrip().rstrip())
> > chars = []
> > elif n > 0:
> > chars.append(c)
> > return parts
>
> It's probably easier to understand and implement when you process the
> complete text at once. Then arbitrary splits don't get in the way of your
> quest for ( and ). You just have to remember the position of the first
> opening ( and number of opening parens that have to be closed before you
> take the complete expression:
>
> level: 000100
> text: abc(def(gh))ij
>when we are here^
> we need^
>
> A tentative implementation:
>
> $ cat parse.py
> import re
>
> NOT_SET = object()
>
> def scan(text):
> level = 0
> start = NOT_SET
> for m in re.compile("[()]").finditer(text):
> if m.group() == ")":
> level -= 1
> if level < 0:
> raise ValueError("underflow: more closing than opening
> parens")
> if level == 0:
> # outermost closing parenthesis:
> # deliver enclosed string including parens.
> yield text[start:m.end()]
> start = NOT_SET
> elif m.group() == "(":
> if level == 0:
> # outermost opening parenthesis: remember position.
> assert start is NOT_SET
> start = m.start()
> level += 1
> else:
> assert False
> if level > 0:
> raise ValueError("unclosed parens remain")
>
>
> if __name__ == "__main__":
> with open("lan sample text file.txt") as instream:
> text = instream.read()
> for chunk in scan(text):
> print(chunk)
> $ python3 parse.py
> ("xE'", PUT(xx..),"'")
> ("TRUuuuth")
Hello Peter! I tried this on my actual working files and it returned this
error: "unclosed parens remain". In this case, how can I continue to parse
through my text files by only extracting those with balanced parentheses and
ignore those that are incomplete?
--
https://mail.python.org/mailman/listinfo/python-list
Re: Extract sentences in nested parentheses using Python
On Tuesday, 3 December 2019 06:22:52 UTC+8, DL Neil wrote:
> On 3/12/19 6:00 AM, Peter Otten wrote:
> > A S wrote:
> > I think I've seen this question before ;)
>
> In addition to 'other reasons' for @Peter's comment, it is a common
> ComSc worked-problem or assignment. (in which case, we'd appreciate
> being told that you/OP is asking for help with "homework")
>
>
> >> I am trying to extract all strings in nested parentheses (along with the
> >> parentheses itself) in my .txt file. Please see the sample .txt file that
> >> I have used in this example here:
> >> (https://drive.google.com/open?id=1UKc0ZgY9Fsz5O1rSeBCLqt5dwZkMaQgr).
> >>
> >> I have tried and done up three different codes but none of them seems to
> >> be able to extract all the nested parentheses. They can only extract a
> >> portion of the nested parentheses. Any advice on what I've done wrong
> >> could really help!
>
> One approach is to research in the hope that there are already existing
> tools or techniques which may help/save you from 'reinventing the wheel'
> - when you think about it, a re-statement of open-source objectives.
>
> How does the Python interpreter break-down Python (text) code into its
> constituent parts ("tokens") *including* parentheses? Such are made
> available in (perhaps) a lesser-known corner of the PSL (Python Standard
> Library). Might you be able to use one such tool?
>
> The ComSc technique which sprang to mind involves "stacks" (a LIFO data
> structure) and "RPN" (Reverse Polish Notation). Whereas we like people
> to take their turn when it comes to limited resources, eg to form a
> "queue" to purchase/pay for goods at the local store, which is "FIFO"
> (first-in, first-out); a "stack"/LIFO (last-in, first-out) can be
> problematic to put into practical application. There are plenty of
> Python implementations or you can 'roll your own' with a list. Again,
> I'd likely employ a "deque" from the PSL's Collections library (although
> as a "stack" rather than as a "double-ended queue"), because the
> optimisation comes "free". (to my laziness, but after some kind soul
> sweated-bullets to make it fast (in both senses) for 'the rest of us'!)
>
>
> > It's probably easier to understand and implement when you process the
> > complete text at once. Then arbitrary splits don't get in the way of your
> > quest for ( and ). You just have to remember the position of the first
> > opening ( and number of opening parens that have to be closed before you
> > take the complete expression:
>
> +1
> but as a 'silver surfer', I don't like to be asked to "remember" anything!
>
>
> > level: 000100
> > we need^
>
>
> Consider:
> original_text (the contents of the .txt file - add buffering if volumes
> are huge)
> current_text (the characters we have processed/"recognised" so-far)
> stack (what an original name for such a data-structure! Which will
> contain each of the partial parenthetical expressions found - but yet to
> be proven/made complete)
>
> set current_text to NULSTRING
> for each current_character in original_text:
> if current_character is LEFT_PARENTHESIS:
> push current_text to stack
> set current_text to LEFT_PARENTHESIS
> concatenate current_character with current_text
> if current_character is RIGHT_PARENTHESIS:
> # current_text is a parenthetical expression
> # do with it what you will
> pop the stack
> set current_text to the ex-stack string \
> concat current_text's p-expn
>
> Once working: cover 'special cases' (after above loop), eg original_text
> which doesn't begin and/or end with parentheses; and error cases, eg
> pop-ping a NULSTRING, or thinking things are finished but the stack is
> not yet empty - likely events from unbalanced parentheses!
>
> original text = "abc(def(gh))ij"
>
> event 1: in-turn, concatenate characters "abc" as current_text
> event 2: locate (first) left-parenthesis, push current_text to stack(&)
> event 3: concatenate "(def"
> event 4: push, likewise
> event 5: concatenate "(gh"
> event 6: locate (first) right-parenthesis (matches to left-parenthesis
> begining the current_string!)
> result?: ?print current_text?
> event 7: pop stack and redefine current_text as &
Re: Extract sentences in nested parentheses using Python
On Tuesday, 3 December 2019 23:48:21 UTC+8, Peter Otten wrote:
> A S wrote:
>
> > On Tuesday, 3 December 2019 01:01:25 UTC+8, Peter Otten wrote:
> >> A S wrote:
> >>
> >> I think I've seen this question before ;)
> >>
> >> > I am trying to extract all strings in nested parentheses (along with
> >> > the parentheses itself) in my .txt file. Please see the sample .txt
> >> > file that I have used in this example here:
> >> > (https://drive.google.com/open?id=1UKc0ZgY9Fsz5O1rSeBCLqt5dwZkMaQgr).
> >> >
> >> > I have tried and done up three different codes but none of them seems
> >> > to be able to extract all the nested parentheses. They can only extract
> >> > a portion of the nested parentheses. Any advice on what I've done wrong
> >> > could really help!
> >> >
> >> > Here are the three codes I have done so far:
> >> >
> >> > 1st attempt:
> >> >
> >> > import re
> >> > from os.path import join
> >> >
> >> > def balanced_braces(args):
> >> > parts = []
> >> > for arg in args:
> >> > if '(' not in arg:
> >> > continue
> >>
> >> There could still be a ")" that you miss
> >>
> >> > chars = []
> >> > n = 0
> >> > for c in arg:
> >> > if c == '(':
> >> > if n > 0:
> >> > chars.append(c)
> >> > n += 1
> >> > elif c == ')':
> >> > n -= 1
> >> > if n > 0:
> >> > chars.append(c)
> >> > elif n == 0:
> >> > parts.append(''.join(chars).lstrip().rstrip())
> >> > chars = []
> >> > elif n > 0:
> >> > chars.append(c)
> >> > return parts
> >>
> >> It's probably easier to understand and implement when you process the
> >> complete text at once. Then arbitrary splits don't get in the way of your
> >> quest for ( and ). You just have to remember the position of the first
> >> opening ( and number of opening parens that have to be closed before you
> >> take the complete expression:
> >>
> >> level: 000100
> >> text: abc(def(gh))ij
> >>when we are here^
> >> we need^
> >>
> >> A tentative implementation:
> >>
> >> $ cat parse.py
> >> import re
> >>
> >> NOT_SET = object()
> >>
> >> def scan(text):
> >> level = 0
> >> start = NOT_SET
> >> for m in re.compile("[()]").finditer(text):
> >> if m.group() == ")":
> >> level -= 1
> >> if level < 0:
> >> raise ValueError("underflow: more closing than opening
> >> parens")
> >> if level == 0:
> >> # outermost closing parenthesis:
> >> # deliver enclosed string including parens.
> >> yield text[start:m.end()]
> >> start = NOT_SET
> >> elif m.group() == "(":
> >> if level == 0:
> >> # outermost opening parenthesis: remember position.
> >> assert start is NOT_SET
> >> start = m.start()
> >> level += 1
> >> else:
> >> assert False
> >> if level > 0:
> >> raise ValueError("unclosed parens remain")
> >>
> >>
> >> if __name__ == "__main__":
> >> with open("lan sample text file.txt") as instream:
> >> text = instream.read()
> >> for chunk in scan(text):
> >> print(chunk)
> >> $ python3 parse.py
> >> ("xE'", PUT(xx..),"'")
> >> ("TRUuuuth")
> >
> > Hello Peter! I tried this on my actual working files and it returned this
> > error: "unclosed parens remain". In this case, how can I continue to parse
> > through my text files by only extracting those with balanced parentheses
> > and ignore those that are incomplete?
>
> filenames = ...
> for filename in filenames:
> with open(filename) as instream:
> text = instream.read()
> try:
> chunks = list(scan(text))
> except ValueError as err:
> print(f"{err} in file {filename!r}", file=sys.stderr)
> else:
>for chunk in chunks:
>print(chunk)
hey Peter, it works! Thank you :)
--
https://mail.python.org/mailman/listinfo/python-list
Extract all words between two keywords in .txt file (Python)
I would like to extract all words within specific keywords in a .txt file. For
the keywords, there is a starting keyword of "PROC SQL;" (I need this to be
case insensitive) and the ending keyword could be either "RUN;", "quit;" or
"QUIT;". This is my sample .txt file.
Thus far, this is my code:
with open('lan sample text file1.txt') as file:
text = file.read()
regex = re.compile(r'(PROC SQL;|proc sql;(.*?)RUN;|quit;|QUIT;)')
k = regex.findall(text)
print(k)
Output:
[('quit;', ''), ('quit;', ''), ('PROC SQL;', '')]
However, my intended output is to get the words in between and inclusive of the
keywords:
proc sql; ("TRUuuuth");
hhhjhfjs as fdsjfsj:
select * from djfkjd to jfkjs
(
SELECT abc AS abc1, abc_2_ AS efg, abc_fg, fkdkfj_vv, jjsflkl_ff, fjkdsf_jfkj
FROM &xxx..xxx_xxx_xxE
where ((xxx(xx_ix as format '-xx') gff &jfjfsj_jfjfj.) and
(xxx(xx_ix as format '-xx') lec &jgjsd_vnv.))
);
1)
jj;
select xx("xE'", PUT(xx..),"'") jdfjhf:jhfjj from _x_xx_L ;
quit;
PROC SQL; ("CUuuuth");
hhhjhfjs as fdsjfsj:
select * from djfkjd to jfkjs
(SELECT abc AS abc1, abc_2_ AS efg, abc_fg, fkdkfj_vv, jjsflkl_ff, fjkdsf_jfkj
FROM &xxx..xxx_xxx_xxE
where ((xxx(xx_ix as format '-xx') gff &jfjfsj_jfjfj.) and
(xxx(xx_ix as format '-xx') lec &jgjsd_vnv.))(( ))
);
2)(
RUN;
__
Any advice or different ways to go about this would be greatly appreciated!
--
https://mail.python.org/mailman/listinfo/python-list
Re: Extract all words between two keywords in .txt file (Python)
On Thursday, 12 December 2019 02:28:09 UTC+8, Ben Bacarisse wrote:
> A S writes:
>
> > I would like to extract all words within specific keywords in a .txt
> > file. For the keywords, there is a starting keyword of "PROC SQL;" (I
> > need this to be case insensitive) and the ending keyword could be
> > either "RUN;", "quit;" or "QUIT;". This is my sample .txt file.
> >
> > Thus far, this is my code:
> >
> > with open('lan sample text file1.txt') as file:
> > text = file.read()
> > regex = re.compile(r'(PROC SQL;|proc sql;(.*?)RUN;|quit;|QUIT;)')
> > k = regex.findall(text)
> > print(k)
>
> Try
>
> re.compile(r'(?si)(PROC SQL;.*(?:QUIT|RUN);)')
>
> Read up one what (?si) means and what (?:...) means.. You can do the
> same by passing flags to the compile method.
>
> > Output:
> >
> > [('quit;', ''), ('quit;', ''), ('PROC SQL;', '')]
>
> Your main issue is that | binds weakly. Your whole pattern tries to
> match any one of just four short sub-patterns:
>
> PROC SQL;
> proc sql;(.*?)RUN;
> quit;
> QUIT;
>
> --
> Ben.
Hey Ben, this works for my sample .txt file! Thanks:) but it wont work, if I
have other multiple text files to parse through that, are similar but have some
variations, strangely enough.
--
https://mail.python.org/mailman/listinfo/python-list
Re: Extract all words between two keywords in .txt file (Python)
On Thursday, 12 December 2019 04:55:46 UTC+8, Joel Goldstick wrote:
> On Wed, Dec 11, 2019 at 1:31 PM Ben Bacarisse wrote:
> >
> > A S writes:
> >
> > > I would like to extract all words within specific keywords in a .txt
> > > file. For the keywords, there is a starting keyword of "PROC SQL;" (I
> > > need this to be case insensitive) and the ending keyword could be
> > > either "RUN;", "quit;" or "QUIT;". This is my sample .txt file.
> > >
> > > Thus far, this is my code:
> > >
> > > with open('lan sample text file1.txt') as file:
> > > text = file.read()
> > > regex = re.compile(r'(PROC SQL;|proc sql;(.*?)RUN;|quit;|QUIT;)')
> > > k = regex.findall(text)
> > > print(k)
> >
> > Try
> >
> > re.compile(r'(?si)(PROC SQL;.*(?:QUIT|RUN);)')
> >
> > Read up one what (?si) means and what (?:...) means.. You can do the
> > same by passing flags to the compile method.
> >
> > > Output:
> > >
> > > [('quit;', ''), ('quit;', ''), ('PROC SQL;', '')]
> >
> > Your main issue is that | binds weakly. Your whole pattern tries to
> > match any one of just four short sub-patterns:
> >
> > PROC SQL;
> > proc sql;(.*?)RUN;
> > quit;
> > QUIT;
> >
> > --
> > Ben.
> > --
> > https://mail.python.org/mailman/listinfo/python-list
>
> Consider using python string functions.
>
> 1. read your string, lets call it s.
> 2 . start = s.find("PROC SQL:"
> This will find the starting index point. It returns and index
> 3. DO the same for each of the three possible ending strings. Use if/else
> 4. This will give you your ending index.
> 5 slice the included string, taking into account the start is start +
> len("PROC SQL;") and the end is the ending index - the length of
> whichever string ended in your case
>
> Regular expressions are powerful, but not so easy to read unless you
> are really into them.
> --
> Joel Goldstick
> http://joelgoldstick.com/blog
> http://cc-baseballstats.info/stats/birthdays
Hey Joel, not too sure if i get the idea of your code implementation
--
https://mail.python.org/mailman/listinfo/python-list
Pkg iter_module for different versions of python
as a sysadmin I've written several small tools as python command line apps that get installed with python setup.py install. I would now like to create another tool that would quickly list out all of my custom tools that may be installed on the system. so that others can get a quick menu of what commands are available. I believe I have a working app that uses the iter_modules function to list out all of the names and then I just filter based on names that I know to be mine. My problem.. This works if everyone of my tools is only written in python 3 or 2, but not both. Are there any tricks to getting iter_modules to return both python 3 and 2 installed modules? J -- https://mail.python.org/mailman/listinfo/python-list
Fwd: Pkg iter_module for different versions of python
Might anyone know of a root place where python modules get saved to for
both python2 and 3. I assume I'm looking for all of the places where
"site-packages" can be written to.
J
-- Forwarded message -----
From: J A
Date: Sun, 9 Feb 2020 at 17:56
Subject: Re: Pkg iter_module for different versions of python
To: DL Neil
Ya.. perhaps it would make more sense to start with "dirty" knowledge. I.e.
a list of package/module names and then make sure they have the required
entry points, therefore "validating" that they belong to me.
Is there a valid directory structure to start from that is universal?
perhaps from there I could parse through site-packages/**/MODULE_name.whl
or something?
and yes no more python 2 however a few of my commands are/were wrapping
third party tool api's that are python 2 :/
J
On Sun, 9 Feb 2020 at 17:05, DL Neil via Python-list
wrote:
> On 10/02/20 4:46 AM, J A wrote:
> > as a sysadmin I've written several small tools as python command line
> apps
> > that get installed with python setup.py install. I would now like to
> create
> > another tool that would quickly list out all of my custom tools that may
> be
> > installed on the system. so that others can get a quick menu of what
> > commands are available. I believe I have a working app that uses the
> > iter_modules function to list out all of the names and then I just filter
> > based on names that I know to be mine.
> >
> > My problem.. This works if everyone of my tools is only written in
> python 3
> > or 2, but not both. Are there any tricks to getting iter_modules to
> return
> > both python 3 and 2 installed modules?
>
>
> Is the issue with iter_modules?
>
> Remember that different Python versions are installed with separate
> libraries/paths. Accordingly, this lap-top's /usr/lib64 has both
> python2.7/ and python3.7/ sub-directories.
>
> When an application is running under one* or the other, the sys.path
> changes accordingly (assuming the pkgutil.iter_modules(path=None) option).
>
> (in case needed) Remember also that different installation methods may
> install packages in different directories anyway, eg personal
> installation or system-wide. So, even 'this' sys.path may not reveal
> what is present on 'this system'.
>
> Might it be worth reversing the strategy and starting from a list of
> your modules, search likely portions of the directory-structure for
> 'your stuff'?
> (from a perspective of complete ignorance of the problem domain)
>
> * requisite notice about not using deprecated Python2.n these days!
> ("Do as I say, but not as I do"? I suspect/hope that this system's 2.7
> is 'legacy' and no longer used for anything, including the OpSys)
> --
> Regards =dn
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
https://mail.python.org/mailman/listinfo/python-list
Application setup like windows msi
I was wondering g if there was a way to distribute an application that took advantage of user input like a windows .msi does. On linux of course. -- https://mail.python.org/mailman/listinfo/python-list
How to copy paragraphs (with number formatting) and images from Words (.docx) and paste into Excel (.xlsx) using Python
I have contract clauses in Words (.docx) format that needs to be frequently
copy and pasted into Excel (.xlsx) to be sent to the third party. The clauses
are often updated hence there's always a need to copy and paste these clauses
over. I only need to copy and paste all the paragraphs and images after the
contents page. Here is a sample of the Clause document
(https://drive.google.com/open?id=1ZzV29R6y2q0oU3HAVrqsFa158OhvpxEK).
I have tried doing up a code using Python to achieve this outcome. Here is the
code that I have done so far:
!pip install python-docx
import docx
import xlsxwriter
document = docx.Document("Clauses Sample.docx")
wb = xlsxwriter.Workbook('C://xx//clauses sample.xlsx')
docText = []
index_row = 0
Sheet1 = wb.add_worksheet("Shee")
for paragraph in document.paragraphs:
if paragraph.text:
docText.append(paragraph.text)
xx = '\n'.join(docText)
Sheet1.write(index_row,0, xx)
index_row = index_row+1
wb.close()
#print(xx)
However, my Excel file output looks like this:
I can't seem to paste pictures into this discussion so please see both my
current and desired Excel output here:
https://stackoverflow.com/questions/60800494/how-to-copy-paragraphs-with-number-formatting-and-images-from-words-docx-an
--
https://mail.python.org/mailman/listinfo/python-list
Re: How to copy paragraphs (with number formatting) and images from Words (.docx) and paste into Excel (.xlsx) using Python
On Monday, 23 March 2020 01:58:38 UTC+8, Beverly Pope wrote: > > On Mar 22, 2020, at 9:47 AM, A S wrote: > > > > I can't seem to paste pictures into this discussion so please see both my > > current and desired Excel output here: > > > > https://stackoverflow.com/questions/60800494/how-to-copy-paragraphs-with-number-formatting-and-images-from-words-docx-an > > > > <https://stackoverflow.com/questions/60800494/how-to-copy-paragraphs-with-number-formatting-and-images-from-words-docx-an> > Did you try using the 2 part answer on the stackoverflow webpage? > > Bev in TX I'm able to get the paragraphs copied correctly now! But i'm trying to figure out if there's a way to copy and paste the images into the Excel, along with the paragraphs as well. Do you have an idea? :) -- https://mail.python.org/mailman/listinfo/python-list
Re: RAW_INPUT
On Mon, 2005-11-07 at 07:57 -0800, john boy wrote:
> I am having trouble with the following example used in a tutorial:
>
> print "Halt !"
> s = raw_input ("Who Goes there? ")
> print "You may pass,", s
at this print line you need to do
print "you may pass, %s" % s
this will allow you to enter the string s into the output sentence
>
> I run this and get the following:
> Halt!
> Who Goes there?
>
> --thats itif I hit enter again "You may pass,"
> appears...
>
> In the example after running you should get:
>
> Halt!
> Who Goes there? Josh
> You may pass, Josh
>
> I'm assuming s=Josh...but that is not included in the statement at all
> I don't know how you put "Josh" in or how you got it to finish running
> w/o hitting enter after "Who goes there?"
>
> What am I doing wrong?
>
> thanks,
> -xray-
>
>
> __
> Yahoo! FareChase - Search multiple travel sites in one click.
> --
> http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list
first post: new to pythong. some questions.
Hello. Im brand new to this list and to python. Ive recently started reading about it
and am now in the tinkering stage. I have a script im working on that i need some
asistance debugging. Its super small and should be a snap for you gurus =)
I have 2 files in a dir off my home dir:
mkoneurl.py
make_ou_class.py
--mkoneurl.py--
#! /usr/bin/env python
import make_ou_class
run = makeoneurl()
-
--make_ou_class.py--
class makeoneurl:
def __init__():
self.commandline()
def commandline():
com = str(raw_input(":"))
#Parse out any params and aguements - reg expressions
#params[] array to hold paramters
params = 0
if com == "ou":
self.ou(params)
else:
print com + " unknown command."
def ou(parameter):
print "hello world"
self.commandline():
---
Why i run mkoneurl.py by typing "python mkonurl.py" i get the following error:
Traceback (innermost last):
File "mkoneurl.py", line 5, in ?
run = makeoneurl()
NameError: makeoneurl
am i missing something here? Any help would be greatly appreciated. Thank you
--Shawn
--
http://mail.python.org/mailman/listinfo/python-list
Native widgets for Python
Which other GUI library for Python other than wxpython has native widgets for MS Windows ? I know there is MFC and GDI, but I want something easier to use than wx, not harder :) wxpython has to problem that it handles much more like a C++ library than a Python one sometimes. Alex -- http://mail.python.org/mailman/listinfo/python-list
help for conversion of NUMARRAY to PIL object
hi, everybody here, I am a newbie to python. I encounter a problem that how to convert an array of numarray to pil object. For example, the data in an image is extracted using Image.getdata, then the data are converted into an array in numarray. But when the array is needed to convert to the pil object, I lose my mind. Could somebody here provide some solutions to this problem? (In other words, all I need is the interface between reading/writing image data and NUMARRAY.) Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list
Re: help for conversion of NUMARRAY to PIL object
Thanks. But some problems remain.
I have known using Image.tostring/fromstring and
numarray.tostring/fromstring can do the job. But when confronting
multi-spectral images, e.g., RGB color images, I don't know how to do
it. Could you give some advices on that?
You wrote "In [14]: img = Image.frombuffer('RGBA', (256,256), a) ", but
it seems that "a" cannot work in "frombuffer".
--
http://mail.python.org/mailman/listinfo/python-list
How to clear screen in Python interactive shell mode?
In Python interactive mode, is there some function acting like 'clear' command in bash? Could somebody here give some advice? Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list
Re: help for conversion of NUMARRAY to PIL object
Sorry, I make the mistakes. I have known how to use to/fromstring method to interface between PIL and Numarray. And your code does work. Another question. Just like the code you provide, is it possible to directly load image data from PIL to Numarray array without use of to/fromstring method? Thank you very much for your kindly help. A.L. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to clear screen in Python interactive shell mode?
Thank you very much. I have tested it under Cygwin, and that works. But it fails under Windows Python Shell Mode. -- http://mail.python.org/mailman/listinfo/python-list
Is There the Equivalent of FLT_EPS of C In Python?
I am writing the code involved in numerical computation. When I need a float epsilon similar to FLT_EPS in C, eps in matlab, I fail to find the equivalent in python. Could somebody here can give me some advices? -- http://mail.python.org/mailman/listinfo/python-list
Re: How to clear screen in Python interactive shell mode?
I have tested it under windows python console, and it works. Thank you very much. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is There the Equivalent of FLT_EPS of C In Python?
Thank you very much. I have searched in python's documentation, and I am sure that python doesn't provide an epsilon. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is There the Equivalent of FLT_EPS of C In Python?
According to pp 134 of "C: A Reference Manual", it's better to use eps*2 in your code. -- http://mail.python.org/mailman/listinfo/python-list
Debugging Python Scripts inside other processes
I embedded Python in a Windows C++ program. Now I want to debug my embedded scripts which of course won't run in any IDE process. Commercial IDEs like WingIDE can attach to external processes by importing a module in the scripts. Is there a debugger capable of this which is Free or Open Source? What I need are the following things: - runs in Windows - single stepping - variable watches - breakpoints Just the typical debugger stuff. Alex -- http://mail.python.org/mailman/listinfo/python-list
Re: Debugging Python Scripts inside other processes
Robin Becker wrote: A. Klingenstein wrote: I embedded Python in a Windows C++ program. Now I want to debug my embedded scripts which of course won't run in any IDE process. Commercial IDEs like WingIDE can attach to external processes by importing a module in the scripts. Is there a debugger capable of this which is Free or Open Source? What I need are the following things: - runs in Windows - single stepping - variable watches - breakpoints Just the typical debugger stuff. Alex I used hapdebugger for such a purpose some time ago, but I believe it needs a special startup python.exe. I looked at it, but couldn't get it to work. A special python.exe won't work for me since I only link against python24.dll, nothing else Alex -- http://mail.python.org/mailman/listinfo/python-list
install questions
Hi, All,
I'm new in Python. I just install ActivePython 2.4 on
my PC and also install SOAPpy-0.11.6.zip,
soapy-0.1.win32.exe. When I run the following script,
I got no module named SOAPpy. Am I missing any
modules? Thanks
Angela
error message:
Traceback (most recent call last):
File
"C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
line 310, in RunScript
exec codeObject in __main__.__dict__
File "C:\test1.py", line 1, in ?
import SOAPpy
ImportError: No module named SOAPpy
=
Python script:
import SOAPpy
WSDL_URI =
"http://www.xmethods.net/sd/2001/TemperatureService.wsdl";
service = SOAPpy.WSDL.Proxy(WSDL_URI)
# if you are behind a proxy server, you need to set
this
service.soapproxy.http_proxy = 'PROXY_HOST:PROXY_PORT'
# set config so that we dump the SOAP envelopes
# (sometimes you will be thrilled to see the SOAP
envelopes)
service.soapproxy.config.dumpSOAPOut = 1
service.soapproxy.config.dumpSOAPIn = 1
temp = service.getTemp('90210') # get temperature in
Beverly Hills
print 'The temperature in Beverly Hills is',temp,'F'
===
__
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail
--
http://mail.python.org/mailman/listinfo/python-list
Problem installing Python in Win98se
Hi, I want to install Python on my Windows 98se system, but although I followed the instructions carefully, it won't run. Here's a copy of the Web instructions I followed, from Python.org: "Starting with the Python 2.4 releases the Windows Python installer is being distributed as a Microsoft Installer (.msi) file. To use this, the Windows system must support Microsoft Installer 2.0. Just save the installer file python-2.4.msi to your local machine, then double-click python-2.4.msi to find out if your machine supports MSI. If it doesn't, you'll need to install Microsoft Installer first. Many other packages (such as Word and Office) also include MSI, so you may already have it on your system. If not, you can download it freely from Microsoft for Windows 95, 98 and Me" The installer I downloaded from Microsoft and ran is called InstMsiA.exe. That seemed to install fine, but the .msi file still won't run. Any ideas what I'm doing wrong? Thanks in advance, Andy <>-- http://mail.python.org/mailman/listinfo/python-list
no module named fcntl
Hello All, I new user to python. I am using a product called FSH, some of its parts are implemented in Python. This is like a ssh to run a command on remote machine. First time while running the fsh there was on. # fshd Traceback (most recent call last): File "/usr/bin/in.fshd", line 6, in ? import infshd File "/home/pra/fsh/1.2/Fileset/share/fsh/infshd.py", line 19, in ? import fcntl ImportError: No module named fcntl I solved this problem. This error is because, fcntl.sl is unable load and the user has no permission to execute the library. After changing the permission for the shared library, it works. But again the problem arises after some time, with out no change. This time # fshd -l user localhost [EMAIL PROTECTED] password: Traceback (most recent call last): File "/usr/bin/in.fshd", line 6, in ? import infshd File "/home/pra/fsh/1.2/Fileset/share/fsh/infshd.py", line 19, in ? import fcntl ImportError: No module named fcntl Pls. suggest me any solution. Pls. forgive me if it is already discussed. Thanks & ReagrdsPrakash.A -- http://mail.python.org/mailman/listinfo/python-list
some sort of permutations...
hello, i'm looking for a way to have all possible length fixed n-uples from a list, i think generators can help, but was not able to do it myself, maybe some one could point me out to an idea to do it ? for example, from : l = [0, 1, 2, 3, 4] and searching for n-uples of 3, i should produce : ( (0, 1, 2), (0, 1, 3), (0, 1, 4), (0, 2, 3), (0, 2, 4), (0, 3, 4), (1, 2, 3), (1, 2, 4), (1, 3, 4), (2, 3, 4), ) does the set module or itertools can help in such cases ? i still have missed the black magic behind itertools... best regards -- http://mail.python.org/mailman/listinfo/python-list
inner sublist positions ?
hello, while trying to play with generator, i was looking for an idea to get the position of a inner list inside another one, here is my first idea : - first find position of first inner element, - and then see if the slice starting from here is equal to the inner -> >>> def subPositions(alist, innerlist): if innerlist == []: return first, start = innerlist[0], 0 while 1: try: p = alist[start:].index(first) except ValueError: break # or should i better use return ? start = start + p if alist[start: start + len(innerlist)] == innerlist: yield start, start + len(innerlist) start += 1 >>> list(subPositions(range(5) + range(5), [2,3])) [(2, 4), (7, 9)] maybe have you some better / faster ideas / implementations ? or even a more pythonic to help me learning that game2 :) => how can i imagine a way to have the inclusion test rather be a test upon a regular expression ? i mean instead of checking for an inner list, rather checking for an "inner regular expression" matching upon consecutives items of a list ? (btw it isn't still not really clear in my own mind, but it looks like ideas from here are always clever one, it may help :) best, -- http://mail.python.org/mailman/listinfo/python-list
Re: Addendum to Strategy/ Advice for How to Best Attack this Problem?
Thank you for the feedback - I have only been programming for 8 months now and
am fairly new to best practice and what is considered acceptable in public
forums. I appreciate the feedback on how to best address this problem.
On Sunday, March 29, 2015 at 8:33:43 AM UTC-4, Peter Otten wrote:
> Saran Ahluwalia wrote:
>
> > On Sunday, March 29, 2015 at 7:33:04 AM UTC-4, Saran Ahluwalia wrote:
> >> Below are the function's requirements. I am torn between using the OS
> >> module or some other quick and dirty module. In addition, my ideal
> >> assumption that this could be cross-platform. "Records" refers to
> >> contents in a file. What are some suggestions from the Pythonistas?
> >>
> >> * Monitors a folder for files that are dropped throughout the day
> >>
> >> * When a file is dropped in the folder the program should scan the file
> >>
> >> o IF all the records in the file have the same length
> >>
> >> o THEN the file should be moved to a "success" folder and a text file
> >> written indicating the total number of records processed
> >>
> >> o IF the file is empty OR the records are not all of the same length
> >>
> >> o THEN the file should be moved to a "failure" folder and a text file
> >> written indicating the cause for failure (for example: Empty file or line
> >> 100 was not the same length as the rest).
> >
> > Below are some functions that I have been playing around with. I am not
> > sure how to create a functional program from each of these constituent
> > parts. I could use decorators or simply pass a function within another
> > function.
>
> Throwing arbitrary code at a task in the hope that something sticks is not a
> good approach. You already have given a clear description of the problem, so
> start with that and try to "pythonize" it. Example:
>
> def main():
> while True:
> files_to_check = get_files_in_monitored_folder()
> for file in files_to_check:
> if is_good(file):
> move_to_success_folder(file)
> else:
> move_to_failure_folder(file)
> wait_a_minute()
>
> if __name__ == "__main__":
> main()
>
> Then write bogus implementations for the building blocks:
>
> def get_files_in_monitored_folder():
> return ["/foo/bar/ham", "/foo/bar/spam"]
>
> def is_good(file):
> return file.endswith("/ham")
>
> def move_to_failure_folder(file):
> print("failure", file)
>
> def move_to_success_folder(file):
> print("success", file)
>
> def wait_a_minute():
> raise SystemExit("bye") # we don't want to enter the loop while
> developing
>
> Now successively replace the dummy function with functions that do the right
> thing. Test them individually (preferrably using unit tests) so that when
> you have completed them all and your program does not work like it should
> you can be sure that there is a flaw in the main function.
>
> > [code]
> > import time
> > import fnmatch
> > import os
> > import shutil
> >
> >
> > #If you want to write to a file, and if it doesn't exist, do this:
>
> Hm, are these your personal notes or is it an actual script?
>
> > if not os.path.exists(filepath):
> > f = open(filepath, 'w')
> > #If you want to read a file, and if it exists, do the following:
> >
> > try:
> > f = open(filepath)
> > except IOError:
> > print 'I will be moving this to the '
> >
> >
> > #Changing a directory to "/home/newdir"
> > os.chdir("/home/newdir")
>
> Never using os.chdir() is a good habit to get into.
>
> > def move(src, dest):
> > shutil.move(src, dest)
> >
> > def fileinfo(file):
> > filename = os.path.basename(file)
> > rootdir = os.path.dirname(file)
> > lastmod = time.ctime(os.path.getmtime(file))
> > creation = time.ctime(os.path.getctime(file))
> > filesize = os.path.getsize(file)
> >
> > print "%s**\t%s\t%s\t%s\t%s" % (rootdir, filename, lastmod, creation,
> > filesize)
> >
> > searchdir = r'D:\Your\Directory\Root'
> > matches = []
> >
> > def search
>
> Everytime you post code that doesn't even compile you lose some goodwill.
> In a few lines of code meant to demonstrate a problem a typo may be
> acceptable, but for something th
Re: Strategy/ Advice for How to Best Attack this Problem?
On Sunday, March 29, 2015 at 10:04:45 PM UTC-4, Chris Angelico wrote: > On Mon, Mar 30, 2015 at 12:08 PM, Paul Rubin wrote: > > Saran Ahluwalia writes: > >> cross-platform... > >> * Monitors a folder for files that are dropped throughout the day > > > > I don't see a cross-platform way to do that other than by waking up and > > scanning the folder every so often (once a minute, say). The Linux way > > is with inotify and there's a Python module for it (search terms: python > > inotify). There might be comparable but non-identical interfaces for > > other platforms. > > All too often, "cross-platform" means probing for one option, then > another, then another, and using whichever one you can. On Windows, > there's FindFirstChangeNotification and ReadDirectoryChanges, which > Tim Golden wrote about, and which I coded up into a teleporter for > getting files out of a VM automatically: > > http://timgolden.me.uk/python/win32_how_do_i/watch_directory_for_changes.html > https://github.com/Rosuav/shed/blob/master/senddir.py > > ChrisA @Dave, Chris, Paul and Dennis: Thank you for resources and the notes regarding what I should keep in mind. I have an initial commit: https://github.com/ahlusar1989/IntroToPython/blob/master/Project1WG_with_assumptions_and_comments.py I welcome your thoughts on this -- https://mail.python.org/mailman/listinfo/python-list
Re: Strategy/ Advice for How to Best Attack this Problem?
On Monday, March 30, 2015 at 2:36:02 PM UTC-4, Dave Angel wrote: > On 03/30/2015 12:45 PM, Saran A wrote: > > On Sunday, March 29, 2015 at 10:04:45 PM UTC-4, Chris Angelico wrote: > >> On Mon, Mar 30, 2015 at 12:08 PM, Paul Rubin > >> wrote: > >>> Saran Ahluwalia writes: > >>>> cross-platform... > >>>> * Monitors a folder for files that are dropped throughout the day > >>> > >>> I don't see a cross-platform way to do that other than by waking up and > >>> scanning the folder every so often (once a minute, say). The Linux way > >>> is with inotify and there's a Python module for it (search terms: python > >>> inotify). There might be comparable but non-identical interfaces for > >>> other platforms. > >> > >> All too often, "cross-platform" means probing for one option, then > >> another, then another, and using whichever one you can. On Windows, > >> there's FindFirstChangeNotification and ReadDirectoryChanges, which > >> Tim Golden wrote about, and which I coded up into a teleporter for > >> getting files out of a VM automatically: > >> > >> http://timgolden.me.uk/python/win32_how_do_i/watch_directory_for_changes.html > >> https://github.com/Rosuav/shed/blob/master/senddir.py > >> > >> ChrisA > > > > @Dave, Chris, Paul and Dennis: Thank you for resources and the notes > > regarding what I should keep in mind. I have an initial commit: > > https://github.com/ahlusar1989/IntroToPython/blob/master/Project1WG_with_assumptions_and_comments.py > > > > I welcome your thoughts on this > > > > It's missing a number of your requirements. But it's a start. > > If it were my file, I'd have a TODO comment at the bottom stating known > changes that are needed. In it, I'd mention: > > 1) your present code is assuming all filenames come directly from the > commandline. No searching of a directory. > > 2) your present code does not move any files to success or failure > directories > > 3) your present code doesn't calculate or write to a text file any > statistics. > > 4) your present code runs once through the names, and terminates. It > doesn't "monitor" anything. > > 5) your present code doesn't check for zero-length files > > I'd also wonder why you bother checking whether the > os.path.getsize(file) function returns the same value as the os.SEEK_END > and ftell() code does. Is it that you don't trust the library? Or that > you have to run on Windows, where the line-ending logic can change the > apparent file size? > > I notice you're not specifying a file mode on the open. So in Python 3, > your sizes are going to be specified in unicode characters after > decoding. Is that what the spec says? It's probably safer to > explicitly specify the mode (and the file encoding if you're in text). > > I see you call strip() before comparing the length. Could there ever be > leading or trailing whitespace that's significant? Is that the actual > specification of line size? > > -- > DaveA @ Dave A On Monday, March 30, 2015 at 2:36:02 PM UTC-4, Dave Angel wrote: > On 03/30/2015 12:45 PM, Saran A wrote: > > On Sunday, March 29, 2015 at 10:04:45 PM UTC-4, Chris Angelico wrote: > >> On Mon, Mar 30, 2015 at 12:08 PM, Paul Rubin > >> wrote: > >>> Saran Ahluwalia writes: > >>>> cross-platform... > >>>> * Monitors a folder for files that are dropped throughout the day > >>> > >>> I don't see a cross-platform way to do that other than by waking up and > >>> scanning the folder every so often (once a minute, say). The Linux way > >>> is with inotify and there's a Python module for it (search terms: python > >>> inotify). There might be comparable but non-identical interfaces for > >>> other platforms. > >> > >> All too often, "cross-platform" means probing for one option, then > >> another, then another, and using whichever one you can. On Windows, > >> there's FindFirstChangeNotification and ReadDirectoryChanges, which > >> Tim Golden wrote about, and which I coded up into a teleporter for > >> getting files out of a VM automatically: > >> > >> http://timgolden.me.uk/python/win32_how_do_i/watch_directory_for_changes.html > >> https://github.com/Rosuav/shed/blob/master/senddir.py > >> > >> ChrisA > > > > @Dave, Chris, Paul and Denn
Re: Strategy/ Advice for How to Best Attack this Problem?
On Tuesday, March 31, 2015 at 9:19:37 AM UTC-4, Dave Angel wrote:
> On 03/31/2015 07:00 AM, Saran A wrote:
>
> > @DaveA: This is a homework assignment. Is it possible that you
> could provide me with some snippets or guidance on where to place your
> suggestions (for your TO DOs 2,3,4,5)?
> >
>
>
> > On Monday, March 30, 2015 at 2:36:02 PM UTC-4, Dave Angel wrote:
>
> >>
> >> It's missing a number of your requirements. But it's a start.
> >>
> >> If it were my file, I'd have a TODO comment at the bottom stating known
> >> changes that are needed. In it, I'd mention:
> >>
> >> 1) your present code is assuming all filenames come directly from the
> >> commandline. No searching of a directory.
> >>
> >> 2) your present code does not move any files to success or failure
> >> directories
> >>
>
> In function validate_files()
> Just after the line
> print('success with %s on %d reco...
> you could move the file, using shutil. Likewise after the failure print.
>
> >> 3) your present code doesn't calculate or write to a text file any
> >> statistics.
>
> You successfully print to sys.stderr. So you could print to some other
> file in the exact same way.
>
> >>
> >> 4) your present code runs once through the names, and terminates. It
> >> doesn't "monitor" anything.
>
> Make a new function, perhaps called main(), with a loop that calls
> validate_files(), with a sleep after each pass. Of course, unless you
> fix TODO#1, that'll keep looking for the same files. No harm in that if
> that's the spec, since you moved the earlier versions of the files.
>
> But if you want to "monitor" the directory, let the directory name be
> the argument to main, and let main do a dirlist each time through the
> loop, and pass the corresponding list to validate_files.
>
> >>
> >> 5) your present code doesn't check for zero-length files
> >>
>
> In validate_and_process_data(), instead of checking filesize against
> ftell, check it against zero.
>
> >> I'd also wonder why you bother checking whether the
> >> os.path.getsize(file) function returns the same value as the os.SEEK_END
> >> and ftell() code does. Is it that you don't trust the library? Or that
> >> you have to run on Windows, where the line-ending logic can change the
> >> apparent file size?
> >>
> >> I notice you're not specifying a file mode on the open. So in Python 3,
> >> your sizes are going to be specified in unicode characters after
> >> decoding. Is that what the spec says? It's probably safer to
> >> explicitly specify the mode (and the file encoding if you're in text).
> >>
> >> I see you call strip() before comparing the length. Could there ever be
> >> leading or trailing whitespace that's significant? Is that the actual
> >> specification of line size?
> >>
> >> --
> >> DaveA
> >
> >
>
> > I ask this because I have been searching fruitlessly through for some time
> > and there are so many permutations that I am bamboozled by which is
> > considered best practice.
> >
> > Moreover, as to the other comments, those are too specific. The scope of
> > the assignment is very limited, but I am learning what I need to look out
> > or ask questions regarding specs - in the future.
> >
>
>
> --
> DaveA
@DaveA
My most recent commit
(https://github.com/ahlusar1989/WGProjects/blob/master/P1version2.0withassumptions_mods.py)
has more annotations and comments for each file.
I have attempted to address the functional requirements that you brought up:
1) Before, my present code was assuming all filenames come directly from the
commandline. No searching of a directory. I think that I have addressed this.
2) My present code does not move any files to success or failure directories
(requirements for this assignment1). I am still wondering if and how I should
use shututil() like you advised me to. I keep receiving a syntax error when
declaring this below the print statement.
3) You correctly reminded me that my present code doesn't calculate or write to
a text file any statistics or errors for the cause of the error. (Should I use
the copy or copy2 method in order provide metadata? If so, should I wrap it
into a try and except logic?)
4) Before, my present code runs once through the names, and terminates. It
doesn't "monitor" anything. I think I have addressed this with the main
function - correct?
5) Before, my present code doesn't check for zero-length files - I have added
a comment there in case that is needed)
I realize appreciate your invaluable feedback. I have grown a lot with this
assignment!
Sincerely,
Saran
--
https://mail.python.org/mailman/listinfo/python-list
Re: Addendum to Strategy/ Advice for How to Best Attack this Problem?
On Sunday, March 29, 2015 at 8:33:43 AM UTC-4, Peter Otten wrote:
> Saran Ahluwalia wrote:
>
> > On Sunday, March 29, 2015 at 7:33:04 AM UTC-4, Saran Ahluwalia wrote:
> >> Below are the function's requirements. I am torn between using the OS
> >> module or some other quick and dirty module. In addition, my ideal
> >> assumption that this could be cross-platform. "Records" refers to
> >> contents in a file. What are some suggestions from the Pythonistas?
> >>
> >> * Monitors a folder for files that are dropped throughout the day
> >>
> >> * When a file is dropped in the folder the program should scan the file
> >>
> >> o IF all the records in the file have the same length
> >>
> >> o THEN the file should be moved to a "success" folder and a text file
> >> written indicating the total number of records processed
> >>
> >> o IF the file is empty OR the records are not all of the same length
> >>
> >> o THEN the file should be moved to a "failure" folder and a text file
> >> written indicating the cause for failure (for example: Empty file or line
> >> 100 was not the same length as the rest).
> >
> > Below are some functions that I have been playing around with. I am not
> > sure how to create a functional program from each of these constituent
> > parts. I could use decorators or simply pass a function within another
> > function.
>
> Throwing arbitrary code at a task in the hope that something sticks is not a
> good approach. You already have given a clear description of the problem, so
> start with that and try to "pythonize" it. Example:
>
> def main():
> while True:
> files_to_check = get_files_in_monitored_folder()
> for file in files_to_check:
> if is_good(file):
> move_to_success_folder(file)
> else:
> move_to_failure_folder(file)
> wait_a_minute()
>
> if __name__ == "__main__":
> main()
>
> Then write bogus implementations for the building blocks:
>
> def get_files_in_monitored_folder():
> return ["/foo/bar/ham", "/foo/bar/spam"]
>
> def is_good(file):
> return file.endswith("/ham")
>
> def move_to_failure_folder(file):
> print("failure", file)
>
> def move_to_success_folder(file):
> print("success", file)
>
> def wait_a_minute():
> raise SystemExit("bye") # we don't want to enter the loop while
> developing
>
> Now successively replace the dummy function with functions that do the right
> thing. Test them individually (preferrably using unit tests) so that when
> you have completed them all and your program does not work like it should
> you can be sure that there is a flaw in the main function.
>
> > [code]
> > import time
> > import fnmatch
> > import os
> > import shutil
> >
> >
> > #If you want to write to a file, and if it doesn't exist, do this:
>
> Hm, are these your personal notes or is it an actual script?
>
> > if not os.path.exists(filepath):
> > f = open(filepath, 'w')
> > #If you want to read a file, and if it exists, do the following:
> >
> > try:
> > f = open(filepath)
> > except IOError:
> > print 'I will be moving this to the '
> >
> >
> > #Changing a directory to "/home/newdir"
> > os.chdir("/home/newdir")
>
> Never using os.chdir() is a good habit to get into.
>
> > def move(src, dest):
> > shutil.move(src, dest)
> >
> > def fileinfo(file):
> > filename = os.path.basename(file)
> > rootdir = os.path.dirname(file)
> > lastmod = time.ctime(os.path.getmtime(file))
> > creation = time.ctime(os.path.getctime(file))
> > filesize = os.path.getsize(file)
> >
> > print "%s**\t%s\t%s\t%s\t%s" % (rootdir, filename, lastmod, creation,
> > filesize)
> >
> > searchdir = r'D:\Your\Directory\Root'
> > matches = []
> >
> > def search
>
> Everytime you post code that doesn't even compile you lose some goodwill.
> In a few lines of code meant to demonstrate a problem a typo may be
> acceptable, but for something that you probably composed in an editor you
> should take the time to run it and fix at least the syntax errors.
>
> > for root, dirnames, filenames in os.walk(searchdir):
> > ## for filename in fnmatch.filter(fil
