I have trouble of obtaining the file size of a file because the
fullpath exceeds 255 characters. I get this message with
os.path.getsize(fullpath).
fullpath = r"\\LOSSSFS002\NWE_TECHNICAL\05. UK\Schiehallion (204_25a)
\Amos&Burke_P559\07. Technical (Subsurface)\06. Well Planning\Amos
\Daily Reports\Wireline\final_204_25a_8z\204_25a_8z\Run_1 A
\HRLA_SP_DSI_PEX_HNGS_ECRD\ANCILLARY\Amos_204_25a-8Z_GR_to_surface_3-
Mar-2008_DSI_HRLA_TLD_MCFL_047PUC.las"
fsize = os.path.getsize(fullpath)
WindowsError: [Error 206] The filename or extension is too long:
The same thing with os.stat(fullpath).
I tried using the relative path, but it does not work with the message
fname not found.
dir = os.path.dirname(fullpath)
fname = os.path.basename(fullpath)
os.chdir(dir)
filesize = os.path.getsize(fname)
Is there a walk around of this? 8 9082 yg*****@gmail.com writes:
I have trouble of obtaining the file size of a file because the
fullpath exceeds 255 characters. I get this message with
os.path.getsize(fullpath).
fullpath = r"\\LOSSSFS002\NWE_TECHNICAL\05. UK\Schiehallion (204_25a)
\Amos&Burke_P559\07. Technical (Subsurface)\06. Well Planning\Amos
\Daily Reports\Wireline\final_204_25a_8z\204_25a_8z\Run_1 A
\HRLA_SP_DSI_PEX_HNGS_ECRD\ANCILLARY\Amos_204_25a-8Z_GR_to_surface_3-
Mar-2008_DSI_HRLA_TLD_MCFL_047PUC.las"
fsize = os.path.getsize(fullpath)
WindowsError: [Error 206] The filename or extension is too long:
The same thing with os.stat(fullpath).
I tried using the relative path, but it does not work with the message
fname not found.
dir = os.path.dirname(fullpath)
fname = os.path.basename(fullpath)
os.chdir(dir)
filesize = os.path.getsize(fname)
Is there a walk around of this?
Disclaimer: I am not a Windows user
Might this help? http://forum.altap.cz/viewtopic.php?p=2353
Alternately, use a better OS :-)
--
Arnaud
On May 13, 3:49*pm, Arnaud Delobelle <arno...@googlemail.comwrote:
ygua...@gmail.com writes:
I have trouble of obtaining the file size of a file because the
fullpath exceeds 255 characters. I get this message with
os.path.getsize(fullpath).
fullpath = r"\\LOSSSFS002\NWE_TECHNICAL\05. UK\Schiehallion (204_25a)
\Amos&Burke_P559\07. Technical (Subsurface)\06. Well Planning\Amos
\Daily Reports\Wireline\final_204_25a_8z\204_25a_8z\Run_1 A
\HRLA_SP_DSI_PEX_HNGS_ECRD\ANCILLARY\Amos_204_25a-8Z_GR_to_surface_3-
Mar-2008_DSI_HRLA_TLD_MCFL_047PUC.las"
fsize = os.path.getsize(fullpath)
WindowsError: [Error 206] The filename or extension is too long:
The same thing with os.stat(fullpath).
I tried using the relative path, but it does not work with the message
fname not found.
dir = os.path.dirname(fullpath)
fname = os.path.basename(fullpath)
os.chdir(dir)
filesize = os.path.getsize(fname)
Is there a walk around of this?
Disclaimer: I am not a Windows user
Might this help? *http://forum.altap.cz/viewtopic.php?p=2353
Alternately, use a better OS :-)
--
Arnaud- Hide quoted text -
- Show quoted text -
I tried, but still the same error:
WindowsError: [Error 206] The filename or extension is too long: '\\\\?
\\UNC\\LOSSSFS002\\NWE_TECHNICAL\\05. UK\\Schiehallion (204_25a)\
\Amos&Burke_P559\\07. Technical (Subsurface)\\06. Well Planning\\Amos\
\Daily Reports\\Wireline\\final_204_25a_8z\\204_25a_8z\\R un_1A\
\HRLA_SP_DSI_PEX_HNGS_ECRD\\ANCILLARY\\Amos_204_25 a-8Z_GR_to_surface_3-
Mar-2008_DSI_HRLA_TLD_MCFL_047PUC.las' yg*****@gmail.com wrote:
I have trouble of obtaining the file size of a file because the
fullpath exceeds 255 characters. I get this message with
os.path.getsize(fullpath).
fullpath = r"\\LOSSSFS002\NWE_TECHNICAL\05. UK\Schiehallion (204_25a)
\Amos&Burke_P559\07. Technical (Subsurface)\06. Well Planning\Amos
\Daily Reports\Wireline\final_204_25a_8z\204_25a_8z\Run_1 A
\HRLA_SP_DSI_PEX_HNGS_ECRD\ANCILLARY\Amos_204_25a-8Z_GR_to_surface_3-
Mar-2008_DSI_HRLA_TLD_MCFL_047PUC.las"
fsize = os.path.getsize(fullpath)
WindowsError: [Error 206] The filename or extension is too long:
The same thing with os.stat(fullpath).
I tried using the relative path, but it does not work with the message
fname not found.
dir = os.path.dirname(fullpath)
fname = os.path.basename(fullpath)
os.chdir(dir)
I suspect that the cause of the problem here is that while *x OSes have
just one current working directory, Windows has one cwd per drive.
filesize = os.path.getsize(fname)
Is there a walk around of this?
At the DOS command level, you can do
subst x: very\long\path
and then refer to
x:filestem.ext
where x is any unused drive letter.
This seems to work:
>>import os os.system('subst x: c:\\junk')
0
>>f = open('x:foo.py') f.read()
"print 'hello'\n"
>>>
HTH,
John
On May 13, 4:38*pm, John Machin <sjmac...@lexicon.netwrote:
ygua...@gmail.com wrote:
I have trouble of obtaining the file size of a file because the
fullpath exceeds 255 characters. I get this message with
os.path.getsize(fullpath).
fullpath = r"\\LOSSSFS002\NWE_TECHNICAL\05. UK\Schiehallion (204_25a)
\Amos&Burke_P559\07. Technical (Subsurface)\06. Well Planning\Amos
\Daily Reports\Wireline\final_204_25a_8z\204_25a_8z\Run_1 A
\HRLA_SP_DSI_PEX_HNGS_ECRD\ANCILLARY\Amos_204_25a-8Z_GR_to_surface_3-
Mar-2008_DSI_HRLA_TLD_MCFL_047PUC.las"
fsize = os.path.getsize(fullpath)
WindowsError: [Error 206] The filename or extension is too long:
The same thing with os.stat(fullpath).
I tried using the relative path, but it does not work with the message
fname not found.
dir = os.path.dirname(fullpath)
fname = os.path.basename(fullpath)
os.chdir(dir)
I suspect that the cause of the problem here is that while *x OSes have
just one current working directory, Windows has one cwd per drive.
filesize = os.path.getsize(fname)
Is there a walk around of this?
At the DOS command level, you can do
* * *subst x: very\long\path
and then refer to
* * *x:filestem.ext
where x is any unused drive letter.
This seems to work:
*>>import os
*>>os.system('subst x: c:\\junk')
0
*>>f = open('x:foo.py')
*>>f.read()
"print 'hello'\n"
*>>>
HTH,
John- Hide quoted text -
- Show quoted text -
Good idea. But subst does not see to work with path that has spaces.
It gives "Incorrect number of parameters" yg*****@gmail.com wrote:
On May 13, 4:38 pm, John Machin <sjmac...@lexicon.netwrote:
>ygua...@gmail.com wrote:
>>I have trouble of obtaining the file size of a file because the fullpath exceeds 255 characters. I get this message with
At the DOS command level, you can do subst x: very\long\path and then refer to x:filestem.ext where x is any unused drive letter.
Good idea. But subst does not see to work with path that has spaces.
It gives "Incorrect number of parameters"
If any DOS command-line argument includes spaces, you need to quote it.
os.system(r'subst x: "c:\my big fat path\rab oof\etc etc etc"')
On May 13, 5:31*pm, John Machin <sjmac...@lexicon.netwrote:
ygua...@gmail.com wrote:
On May 13, 4:38 pm, John Machin <sjmac...@lexicon.netwrote:
ygua...@gmail.com wrote: I have trouble of obtaining the file size of a file because the fullpath exceeds 255 characters. I get this message with
At the DOS command level, you can do
* * *subst x: very\long\path
and then refer to
* * *x:filestem.ext
where x is any unused drive letter.
Good idea. But subst does not see to work with path that has spaces.
It gives "Incorrect number of parameters"
If any DOS command-line argument includes spaces, you need to quote it.
os.system(r'subst x: "c:\my big fat path\rab oof\etc etc etc"')
Yes, it works now. I am getting more on windows after coming a long
way from Unix. Thanks a lot.
<yg*****@gmail.comwrote in message
news:41**********************************@z72g2000 hsb.googlegroups.com...
>I have trouble of obtaining the file size of a file because the
fullpath exceeds 255 characters. I get this message with
os.path.getsize(fullpath).
fullpath = r"\\LOSSSFS002\NWE_TECHNICAL\05. UK\Schiehallion (204_25a)
\Amos&Burke_P559\07. Technical (Subsurface)\06. Well Planning\Amos
\Daily Reports\Wireline\final_204_25a_8z\204_25a_8z\Run_1 A
\HRLA_SP_DSI_PEX_HNGS_ECRD\ANCILLARY\Amos_204_25a-8Z_GR_to_surface_3-
Mar-2008_DSI_HRLA_TLD_MCFL_047PUC.las"
fsize = os.path.getsize(fullpath)
WindowsError: [Error 206] The filename or extension is too long:
The same thing with os.stat(fullpath).
I tried using the relative path, but it does not work with the message
fname not found.
dir = os.path.dirname(fullpath)
fname = os.path.basename(fullpath)
os.chdir(dir)
filesize = os.path.getsize(fname)
Is there a walk around of this?
You need to use the '\\?\UNC\' prefix and specify the path
in unicode (Python 2.5 and up).
Roger
En Tue, 13 May 2008 18:06:13 -0300, <yg*****@gmail.comescribió:
On May 13, 3:49*pm, Arnaud Delobelle <arno...@googlemail.comwrote:
>ygua...@gmail.com writes:
I have trouble of obtaining the file size of a file because the
fullpath exceeds 255 characters. I get this message with
WindowsError: [Error 206] The filename or extension is too long: '\\\\?
\\UNC\\LOSSSFS002\\NWE_TECHNICAL\\05. UK\\Schiehallion (204_25a)\
\Amos&Burke_P559\\07. Technical (Subsurface)\\06. Well Planning\\Amos\
\Daily Reports\\Wireline\\final_204_25a_8z\\204_25a_8z\\R un_1A\
\HRLA_SP_DSI_PEX_HNGS_ECRD\\ANCILLARY\\Amos_204_25 a-8Z_GR_to_surface_3-
Mar-2008_DSI_HRLA_TLD_MCFL_047PUC.las'
In addition to starting with \\?\UNC\, the path has to be an Unicode
string, and already normalized (that is, it cannot contain . nor ..
components)
--
Gabriel Genellina This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Joe Laughlin |
last post by:
I've not used C much before, so I don't know how robust or good this code
is. I'd appreciate any feedback or criticisms anyone has!
Thanks,
Joe
#include <stdio.h>
#include <string.h>
|
by: StGo |
last post by:
How can i read/write file's custom attributs(like subject,author...) in
C#???
Thanks :))
|
by: |
last post by:
Hello Guys,
I am trying to render an Xml dataset into HTML using XSLT.
When I am loading the XSLT file into transform object to
render it. Here is the code snippet:
<!--
XslTransform...
|
by: I am Sam |
last post by:
I keep getting this error and I don't know why:
The path is too long after being fully qualified. Make sure path is less
than 260 characters.
Description: An unhandled exception occurred...
|
by: Sakharam Phapale |
last post by:
Hi All,
I am using an API function, which takes file path as an input.
When file path contains special characters (@,#,$,%,&,^, etc), API function
gives an error as "Unable to open input file"....
|
by: santosh |
last post by:
Hello all,
I've put together a small program to count the number of characters and
'words' in a text file. The minimum length of a word, (in terms of no.
of characters), as well as word...
|
by: Rahul |
last post by:
Hi Everybody
I have some problem in my script. please help me. This is script file.
I have one *.inq file. I want run this script in XML files. But this
script errors shows . If u want i am...
|
by: wb5plj |
last post by:
Hi I am having a problem passing some sql to the db2cmd via ant. This
is very confusing as I am doing this exact thing elseware with no
problem (just differant sql, and I have verified the sql is...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |